JavaFX popup is hidden when stage is in full screen

I am trying to open a dialog at my fullscreen main stage in javafx. When I create my popup, it unexpectedly hides behind my full-screen main scene until the frame is removed from full-screen mode (via ESC). If I make my main stage maximally expanded and not decorated, and not full-screen, then my pop-up window will appear at the initial stage, as expected.

Am I missing something about how fullscreen mode differs from maximized and undecorated mode? Am I using full screen mode incorrectly?

I am using java version 1.8.0_20 on CentOS 6.5 with Gnome.

Here is my SSCCE:

import javafx.application.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.stage.*;

public class TestApplication extends Application {
    private Stage primaryStage;

    public static void main(String[] arguments) {
        launch(arguments);
    }

    public void start(Stage stage) {
        this.primaryStage = stage;

        // Create a fullscreen primary stage.    
        primaryStage.setTitle("Main Stage");
        primaryStage.setScene(new Scene(createRoot()));
        primaryStage.setFullScreen(true);

        primaryStage.show();
    }       

    private Parent createRoot() {
        Button button = new Button("Show popup");
        button.setOnAction((event) -> showPopup());

        return button;
    }

    private void showPopup() {
        // Create a popup that should be on top of the primary stage.
        Stage popupStage = new Stage();

        popupStage.setScene(new Scene(createPopupRoot()));
        popupStage.setTitle("Popup Stage");
        popupStage.initModality(Modality.WINDOW_MODAL);
        popupStage.initOwner(primaryStage);

        popupStage.show();
    }

    private Parent createPopupRoot() {
        return new Label("This is a popup!");
    }
}
+2
2

java- "1.8.0_40" , !

popupStage.initStyle(StageStyle.UTILITY);

Stage.initStyle(StageStyle) - JavaFX 8

StageStyle.UTILITY .

Alert java 1.8.0_40, StageStyle.UTILITY (Dialog.initStyle(StageStyle) - JavaFX 8).

, .

:

, popupStage.initOwner(...) , .

+1

, Mac, , ​​ 8u40. , ea .

, JavaFX , OS X 10.7 ( ). " ", . : , ComboBox ... ​​ 8u40 ( OS X 10.7 ).

: Mac OS , .

+2

Source: https://habr.com/ru/post/1570762/


All Articles