BooleanBinding bb = new BooleanBinding() {
{
super.bind(addnum.textProperty(),addt1.textProperty(),addt2.textProperty(),
addt3.textProperty(),addasg.textProperty(),addatt.textProperty());
}
@Override
protected boolean computeValue() {
return (addnum.getText().isEmpty() && addt1.getText().isEmpty()
&& addt2.getText().isEmpty() && addt3.getText().isEmpty()
&& addasg.getText().isEmpty() && addatt.getText().isEmpty());
}
};
final Button b2 = new Button("Add");
b2.disableProperty().bind(bb);
This is my code to disable Button when the TextFields are empty, that is the Button becomes active when all the TextField are filled. But this code is not working. When one TextField is filled the Button becomes active. I had used this code at other parts of my project for this same purpose add it is working fine there. Why is it not working here ?