FULL PRODUCT VERSION :
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux radeks-VirtualBox 4.2.0-36-generic #42~14.04.1-Ubuntu SMP Fri May 13 17:27:22 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Ubuntu is running inside VirtualBox and on physical machine.
A DESCRIPTION OF THE PROBLEM :
Sometimes, when the main stage shows a dialog (child window modal stage), clicking on the parent window resizes it.
The test application has a combination of scene and stage sizes that I can reproduce this most often with.
In my application I don't set the stage size, which causes it to be resized to 1x29 pixels in size, however I couldn't reproduce this exact case in the test application.
This may be related to https://bugs.openjdk.java.net/browse/JDK-8088236
however my problem occurs on local system (both VirtualBox and physical machine).
What I also observed is that the modal stage size is also different between runs of the test application (the height may or may not include the height of window title bar), and occasionally it's not even correctly centered on the parent stage.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the test application.
2. Click on the primary stage.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Nothing happens.
ACTUAL -
The primary stage sometimes resizes.
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class TestMain extends Application {
public static void main(final String... args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
VBox root = new VBox();
root.getChildren().add(new Label("Primary Stage"));
Scene scene = new Scene(root, 200, 200);
primaryStage.setScene(scene);
primaryStage.setHeight(200);
primaryStage.setWidth(200);
primaryStage.setResizable(true);
primaryStage.show();
primaryStage.widthProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("Primary stage width changed from " + oldValue + " to " + newValue);
});
primaryStage.heightProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("Primary stage height changed from " + oldValue + " to " + newValue);
});
Platform.runLater(() -> {
Stage secondStage = new Stage();
secondStage.initOwner(primaryStage);
VBox secondRoot = new VBox();
secondRoot.getChildren().add(new Label("Secondary Stage"));
Scene secondScene = new Scene(secondRoot);
secondStage.setScene(secondScene);
secondStage.setHeight(100);
secondStage.setWidth(100);
secondStage.initModality(Modality.WINDOW_MODAL);
secondStage.show();
});
}
}
---------- END SOURCE ----------