How can you set a TextArea in JavaFX to allow only integers to be entered? -


i trying create textarea in javafx accepts integer values? can give me advice how implement this?

use textformatter:

textarea textarea = new textarea(); // allow digits , whitespace: pattern allowedtext = pattern.compile("[0-9\\s]*"); textformatter formatter = new textformatter((textformatter.change c) -> {     if (allowedtext.matcher(c.gettext()).matches()) {         return c ;     } else {         return null ;     } }); 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

Command prompt result in label. Python 2.7 -