0
我想在JavaFx中創建裝飾舞臺,它也不會移動。我正在從另一個控制器類創建這個階段。我能夠創造和展示舞臺,但它正在自由移動。我如何創建這個?非常感謝幫助和建議。我正在貼上開啓新舞臺的方法。JavaFx中裝飾和不可移動的舞臺
private void addReceiver() {
Parent receivercvDetailsparent;
try {
receivercvDetailsparent = FXMLLoader.load(getClass().getClassLoader().getResource("com/project/fxml/ReceiverDetails.fxml"));
Stage stageReceiver = new Stage();
stageReceiver.initModality(Modality.APPLICATION_MODAL);
stageReceiver.setTitle("AppName v2.0.0");
stageReceiver.setScene(new Scene(receivercvDetailsparent));
stageReceiver.initStyle(StageStyle.DECORATED);
stageReceiver.setResizable(false);
stageReceiver.getIcons().add(new Image("/com/project/images/logo.png"));
stageReceiver.show();
} catch (IOException e) {
e.printStackTrace();
}
}
我需要讓舞臺「StageStyle.DECORATED」,否則min,max,close選項將從窗口中移除。 –
我想你可以自己效仿它們。下面是在ControlsFX庫中如何完成的一個很好的示例https://bitbucket.org/controlsfx/controlsfx/src/cc955ea2b309a4a55e06253f4ac56e94d0d7fa6e/controlsfx/src/main/java/org/controlsfx/dialog/FXDialog.java?at=8.0-最終&fileviewer =文件 - 視圖 - 默認 –