I have a substage that contains a text field. When I close the stage upon text field action (user hits Enter) and the mouse was inside the text field, the cursor remains in TEXT style, even though the stage is closed.
Here's a minimal example to reproduce it:
{code}
public class CursorBugTest extends Application {
private void init(final Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root, 600, 400));
final Button button = new Button("Create a Stage");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
final Stage stage = new Stage();
Group rootGroup = new Group();
Scene scene = new Scene(rootGroup, 200, 200);
stage.setScene(scene);
stage.centerOnScreen();
stage.show();
final TextField textField = new TextField();
textField.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// if the substage is closed while the cursor is within the text field
// the cursor type is still TEXT in the primary stage
button.setText(textField.getText());
stage.close();
}
});
rootGroup.getChildren().add(textField);
}
});
root.getChildren().add(button);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
public static void main(String[] args) { launch(args); }
}
{code}
Here's a minimal example to reproduce it:
{code}
public class CursorBugTest extends Application {
private void init(final Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root, 600, 400));
final Button button = new Button("Create a Stage");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
final Stage stage = new Stage();
Group rootGroup = new Group();
Scene scene = new Scene(rootGroup, 200, 200);
stage.setScene(scene);
stage.centerOnScreen();
stage.show();
final TextField textField = new TextField();
textField.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// if the substage is closed while the cursor is within the text field
// the cursor type is still TEXT in the primary stage
button.setText(textField.getText());
stage.close();
}
});
rootGroup.getChildren().add(textField);
}
});
root.getChildren().add(button);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
public static void main(String[] args) { launch(args); }
}
{code}