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();
}
}
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();
}
}