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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

'hasOwnProperty' in javascript -