JavaFX StringProperty.isEmpty - PullRequest
       3

JavaFX StringProperty.isEmpty

0 голосов
/ 12 февраля 2020

Я работаю над проектом. Застрял в этой части и не понимаю, что не так. Метод должен работать так, чтобы при отсутствии значения всплыло предупреждение, в противном случае программа просто продолжит работу.

   public boolean NotEmpty() {
        if (first_nameProperty().get().isEmpty() || last_nameProperty().get().isEmpty() ||
                birthdateProperty().get().isEmpty() || emailProperty().get().isEmpty() || adressProperty().get().isEmpty()) {

            Alert alert = new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("Validate Fields");
            alert.setContentText("Please Enter Into the Fields ");
            alert.setHeaderText(null);
            alert.showAndWait();

            return false;

        }

        return true;

    }

И функция Button

 Button button = new Button("Add");
        button.setOnAction(e -> {

            if( ui.NotEmpty() == false) {
                list.add(
                        new UserInfo(
                                first_name.getText(),
                                last_name.getText(),
                                Integer.parseInt(age.getText()),
                                birthdate.getEditor().getText(),
                                email.getText(),
                                adress.getText()
                        )
...