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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -