-
Bug
-
Resolution: Fixed
-
P3
-
8u11
-
Mac OS X 10.9.4
Creating a Stage and displaying it in fullscreen ( stage.setFullScreen(true) ) then attempting to display another stage as a modal will not show the modal stage even though true is returned when testing against stage.isFocused(), it does not appear on top of the fullscreen stage. This works perfectly fine under Windows 8.1.
Example code of the issue occuring on Mac:
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.Pane;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import javafx.scene.control.*;
public class Full extends Application
{
private void showPopUp(Window parent)
{
System.out.println("showPopUp...");
Stage stage = new Stage();
stage.setTitle("PopUp");
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(parent);
Pane root = new Pane();
Scene scene = new Scene(root, 180, 200);
stage.setScene(scene);
stage.initStyle(StageStyle.UTILITY);
stage.show();
if (stage.isFocused())
{
System.out.println("Stage: Focused");
}
else
{
System.out.println("Stage: Not Focused");
}
stage.centerOnScreen();
stage.toFront();
//System.out.println("Stage x/y: " + stage.getX() + "/" + stage.getY());
//stage.toFront();
//stage.requestFocus();
//stage.
}
@Override
public void start(Stage primaryStage) throws Exception
{
Pane root = new Pane();
Scene scene = new Scene(root, 640, 480);
Button button = new Button("PopUp Test");
button.setOnAction(event ->
{
Node node = (Node)event.getSource();
showPopUp(node.getScene().getWindow());
});
root.setOnKeyPressed(event ->
{
if (event.getCode() == KeyCode.ESCAPE)
{
primaryStage.close();
}
});
root.getChildren().add(button);
Screen screen = Screen.getPrimary();
Rectangle2D rec = screen.getVisualBounds();
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setWidth(rec.getMaxX()/2);
primaryStage.setHeight(rec.getMaxY()/2);
primaryStage.setFullScreen(true);
primaryStage.setScene(scene);
primaryStage.show();
//primaryStage.requestFocus();
Window win = scene.getWindow();
double fsWidth = win.getWidth();
double fsHeight = win.getHeight();
button.setPrefSize(fsWidth/8, fsHeight/16);
button.setLayoutX(100);// - button.getPrefWidth()/2);
button.setLayoutY(100);
}
public static void main(String[] args)
{
launch(args);
}
}
Example code of the issue occuring on Mac:
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.Pane;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import javafx.scene.control.*;
public class Full extends Application
{
private void showPopUp(Window parent)
{
System.out.println("showPopUp...");
Stage stage = new Stage();
stage.setTitle("PopUp");
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(parent);
Pane root = new Pane();
Scene scene = new Scene(root, 180, 200);
stage.setScene(scene);
stage.initStyle(StageStyle.UTILITY);
stage.show();
if (stage.isFocused())
{
System.out.println("Stage: Focused");
}
else
{
System.out.println("Stage: Not Focused");
}
stage.centerOnScreen();
stage.toFront();
//System.out.println("Stage x/y: " + stage.getX() + "/" + stage.getY());
//stage.toFront();
//stage.requestFocus();
//stage.
}
@Override
public void start(Stage primaryStage) throws Exception
{
Pane root = new Pane();
Scene scene = new Scene(root, 640, 480);
Button button = new Button("PopUp Test");
button.setOnAction(event ->
{
Node node = (Node)event.getSource();
showPopUp(node.getScene().getWindow());
});
root.setOnKeyPressed(event ->
{
if (event.getCode() == KeyCode.ESCAPE)
{
primaryStage.close();
}
});
root.getChildren().add(button);
Screen screen = Screen.getPrimary();
Rectangle2D rec = screen.getVisualBounds();
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setWidth(rec.getMaxX()/2);
primaryStage.setHeight(rec.getMaxY()/2);
primaryStage.setFullScreen(true);
primaryStage.setScene(scene);
primaryStage.show();
//primaryStage.requestFocus();
Window win = scene.getWindow();
double fsWidth = win.getWidth();
double fsHeight = win.getHeight();
button.setPrefSize(fsWidth/8, fsHeight/16);
button.setLayoutX(100);// - button.getPrefWidth()/2);
button.setLayoutY(100);
}
public static void main(String[] args)
{
launch(args);
}
}
- is blocked by
-
JDK-8093750 Mac: Application processes termination prematurely when a nested event loop is running
- Resolved
- relates to
-
JDK-8090131 [FullScreen, Mac] Applet stage in full screen doesn't repaint itself
- Closed