-
Bug
-
Resolution: Fixed
-
P4
-
jfx11
-
x86_64
-
linux_ubuntu
ADDITIONAL SYSTEM INFORMATION :
Ubuntu 18.04
A DESCRIPTION OF THE PROBLEM :
When managing multiple windows on our OpenJfx application sometimes a window that was first opened pops on the front of a current window. It happens when there is a modal window.
We are always sure to initOwner() with the parent window and then set initModality(Modality.WINDOW_MODAL).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The dialog should be on top.
ACTUAL -
The first stage is on top.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.Window;
public class HelloFx extends Application {
@Override
public void start(Stage primaryStage) {
Scene scene = new Scene(new Label("Primary Stage"), 640, 480);
primaryStage.setScene(scene);
primaryStage.show();
new TestStage(primaryStage, "First Window").show();
TestStage secondStage = new TestStage(primaryStage, "Second Window");
secondStage.show();
openLastWindow(secondStage);
}
void openLastWindow(Window owner) {
Dialog dialog = new Dialog();
dialog.initOwner(owner);
dialog.setContentText("Hello world!");
dialog.setTitle("Last Dialog");
dialog.initModality(Modality.WINDOW_MODAL);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
dialog.showAndWait();
}
}
class TestStage extends Stage {
public TestStage(Window owner, String title) {
initOwner(owner);
setTitle(title);
this.setScene(new Scene(new Label("Hello World!"), 400, 400));
}
}
---------- END SOURCE ----------
FREQUENCY : always
Ubuntu 18.04
A DESCRIPTION OF THE PROBLEM :
When managing multiple windows on our OpenJfx application sometimes a window that was first opened pops on the front of a current window. It happens when there is a modal window.
We are always sure to initOwner() with the parent window and then set initModality(Modality.WINDOW_MODAL).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The dialog should be on top.
ACTUAL -
The first stage is on top.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.Window;
public class HelloFx extends Application {
@Override
public void start(Stage primaryStage) {
Scene scene = new Scene(new Label("Primary Stage"), 640, 480);
primaryStage.setScene(scene);
primaryStage.show();
new TestStage(primaryStage, "First Window").show();
TestStage secondStage = new TestStage(primaryStage, "Second Window");
secondStage.show();
openLastWindow(secondStage);
}
void openLastWindow(Window owner) {
Dialog dialog = new Dialog();
dialog.initOwner(owner);
dialog.setContentText("Hello world!");
dialog.setTitle("Last Dialog");
dialog.initModality(Modality.WINDOW_MODAL);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
dialog.showAndWait();
}
}
class TestStage extends Stage {
public TestStage(Window owner, String title) {
initOwner(owner);
setTitle(title);
this.setScene(new Scene(new Label("Hello World!"), 400, 400));
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8222456 Modal Dialog/Stage shows behind "older" window
- Closed
- links to