JavaFX: How to clear a DatePicker value -
this question has answer here:
- how clear datepicker 1 answer
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
Post a Comment