import javafx.application.*; import javafx.beans.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.stage.*; public class RT17968 extends Application { private Group content; @Override public void start(Stage stage) throws Exception { stage.setScene(new Scene(content = new Group(), 500, 500)); stage.centerOnScreen(); stage.show(); final TextField textField = new TextField(); textField.setPromptText("Enter Pithy Pun"); textField.setText("bbbbbbbbbbbbbbbbbbbbb"); textField.selectionProperty().addListener(new InvalidationListener() { public void invalidated(Observable o) { System.out.println(textField.getSelection()); } }); textField.selectAll(); content.getChildren().add(textField); } public static void main(String[] args) { launch(args); } }