Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8123195

When using -fx-prompt-text-fill: darkblue; on TextField promt Text does not dissaapears on focus

XMLWordPrintable

      When using a CSS to style a Textfield the prompt text changes it's color as xpected, but when the user clicks on it the text doesn't dissapears neither the cursor appears, a work around is to make a class to do it:
       @Override
          public void initialize(URL url, ResourceBundle rb) {
             busqueda.focusedProperty().addListener(new ChangeListener<Boolean>() {
                  @Override
                  public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
                      if (!t1) {
                          busqueda.setStyle("-fx-prompt-text-fill: darkblue;"
                                  + " -fx-background-color: #999999, white;\n"
                                  + " -fx-background-insets: 1, 3;\n"
                                  + " -fx-background-radius: 0 0 9 0, 0 0 8 0, 0 0 8 0;\n"
                                  + " -fx-padding: 5px}");
                      } else {
                          busqueda.setStyle("-fx-prompt-text-fill: white;"
                                  + " -fx-background-color: #999999,#336699, white;\n"
                                  + " -fx-background-insets: 1, 2, 3;\n"
                                  + " -fx-background-radius: 0 0 9 0, 0 0 8 0, 0 0 8 0;\n"
                                  + " -fx-padding: 5px}");
                      }
                  }
              });
          }

            jgiles Jonathan Giles
            csaenzjfx Carlos de Luna Saenz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: