I need to restrict text input inside combobox with positive numbers. I've searched stackoverflow for this and found similar question: Recommended way to restrict input in JavaFX textfield
The only difference is that the mentioned question addresses bare textfield. The answer approved by the javafx designers is to extend the TextField
class and override couple of methods: replaceText
and replaceSelection
. This hack does not work with combobox: TextField
instance if stored inside and is avaiable as read-only property named editor
.
So what is the recommended way to restrict text input inside javafx combobox?