[英]JavaFX setAlwaysOnTop on a fullscreen stage
我有一個具有這些屬性的主要階段。 這是一個安全的“鎖定階段”
public static Stage getSecureStage(Window window) throws IOException {
Stage stage = new Stage();
//Take up the entire screen boundaries
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
stage.setHeight(visualBounds.getHeight());
stage.setWidth(visualBounds.getWidth());
//Secure the stage
stage.setFullScreen(true);
stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
stage.setFullScreenExitHint(null);
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(getScene(window));
return stage;
}
在這個鎖定階段,我希望能夠在舞台上彈出 windows
如您所見,該階段在鎖定階段之上進行初始化。 但是,如果我要單擊該彈出窗口並返回主鎖定階段,則鎖定階段將優先考慮並將其置於彈出窗口之上。 它不會最小化它,而只是在頂部。
我已經為彈出窗口提供了屬性
popup.setAlwaysOnTop(true);
popup.initOwner(lockdownStage);
然而,這似乎並沒有奏效。 我以前沒有在 Linux 上使用相同的代碼運行此問題。 如果您需要更多信息,請告訴我
通過擺脫
stage.setFullScreen(true);
stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
stage.setFullScreenExitHint(null);
並將其設置為
stage.setMaximized(true);
使用之前的全屏設置,您還可以使用stage.initModality(Modality.APPLICATION_MODAL);
在彈出 window 上。 在我的情況下,我希望能夠與 windows 進行交互,而不是單獨使用模態功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.