I have the following JavaFX code:
final TextField textField = new TextField();
and anEventHandler<ActionEvent>
with checking textField wether it's empty or not. The problem is that textField.getText() == null
or textField.getText() == ""
both returns false, but i didn't print anything in that field, so it should return true.
final TextField textField = new TextField();
browse.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent actionEvent) {
FileChooser fileChooser = new FileChooser();
File chFile = fileChooser.showOpenDialog(stage);
if (chFile != null) {
// some code
if (textField.getText() != null && textField.getText() != "") {
// some code
}
}
}
});