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

vb.net - How to ignore if a cell is empty nothing -

Sort a complex associative array in PHP -

recursion - Can every recursive algorithm be improved with dynamic programming? -