Testcase:
Run it and you can see in output, that selection is 0,24, but it become blue after minimazing/opening window (I mean, taskbar). You can see on attached movie.
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class HelloTextField 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 label = new TextField();
label.setPromptText("Enter Pithy Pun");
label.setText("bbbbbbbbbbbbbbbbbbbbb");
label.selectionProperty().addListener(new InvalidationListener() {
public void invalidated(Observable o) {
System.out.println(label.getSelection());
}
});
label.selectAll();
content.getChildren().add(label);
//label.setText("aaa");
}
public static void main(String[] args) {
Application.launch(HelloTextField.class, args);
}
}
Run it and you can see in output, that selection is 0,24, but it become blue after minimazing/opening window (I mean, taskbar). You can see on attached movie.
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class HelloTextField 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 label = new TextField();
label.setPromptText("Enter Pithy Pun");
label.setText("bbbbbbbbbbbbbbbbbbbbb");
label.selectionProperty().addListener(new InvalidationListener() {
public void invalidated(Observable o) {
System.out.println(label.getSelection());
}
});
label.selectAll();
content.getChildren().add(label);
//label.setText("aaa");
}
public static void main(String[] args) {
Application.launch(HelloTextField.class, args);
}
}
- relates to
-
JDK-8090213 TextField. Creating, adding, and selecting text in the same tick issue
- Open
-
JDK-8116975 [TextField] Mouse selection goes away when another JavaFX window is clicked
- Closed
-
JDK-8097511 [TextField] selection changing during minimizing window to taskbar and opening it again.
- Closed
-
JDK-8117797 Select on TextFields won't render the selection
- Closed