JavaFX: How to clear a DatePicker value -


this question has answer here:

how clear datepicker value if textfield clear? known, can by:

datepicker.setvalue(null); 

but need listener textfield in datepicker.

you can add changelistener textproperty of textfield.

something like:

textfield.textproperty().isempty().addlistener(new changelistener<boolean>() {       @override       public void changed(final observablevalue<? extends boolean> observable,                  final boolean oldvalue, final boolean newvalue) {            if (newvalue){               datepicker.setvalue(null);             }       } {); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -