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

-fx-display-caret affects late

XMLWordPrintable

      Run the code:

          @Override
          public void start(Stage stage) throws Exception {
              StackPane root = new StackPane();
              final TextField textField = new TextField();

              ToggleButton button = new ToggleButton("Display caret");
              button.setSelected(true);
              button.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent t) {
                      textField.setStyle("-fx-display-caret : " + ((ToggleButton) t.getSource()).isSelected() + ";");
                      System.out.println(textField.getStyle());
                      textField.requestFocus();
                  }
              });
              root.getChildren().add(VBoxBuilder.create().children(textField, button).spacing(50).alignment(Pos.CENTER).build());

              Scene scene = new Scene(root, 300, 300);
              stage.setScene(scene);
              stage.show();
          }

      When -fx-display-caret is set to false, caret is still visible. It becomes invisible, only when focus is put by mouse.
      When -fx-display-caret is set to true, caret is still invisible.

      Affected tests:
      graphics/api/control/TextBox_6aTest.java

            jgiles Jonathan Giles
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: