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

TextField/TextArea: text is not scrolled to show the selection range

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • javafx
    • None
    • b129, Win7

      Text is not scrolled to show the selection range.

      Sample to reproduce:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class App extends Application {

           public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              TextField control = new TextField("one two three four five");
              control.setPrefWidth(80);
              Button button = new Button("Button");
              button.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent t) {
                      control.requestFocus();
                      control.selectRange(control.getText().length(), control.getText().length());
                      control.selectRange(5, 11);
                  }
              });
              Scene scene = new Scene(new VBox(button, new Pane(control)), 100, 100);
              stage.setScene(scene);
              stage.show();
          }
      }

            Unassigned Unassigned
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: