How to disable Button when TextField is empty?

Similar to Uluk’s answer, but using the Bindings fluent API:

btn.disableProperty().bind(
    Bindings.isEmpty(textField1.textProperty())
    .and(Bindings.isEmpty(textField2.textProperty()))
    .and(Bindings.isEmpty(textField3.textProperty()))
);

Also note that, this new overloaded method of Bindings is added in JavaFX-8 and not avaliable in JavaFX-2.

Leave a Comment

tech