简体   繁体   English

无法使用JavaFX最大化窗口

[英]Cannot Maximize Window with JavaFX

I made a custom Minimize button this way: 我这样制作了一个自定义的“最小化”按钮:

public MinimizeButton() {
    Button button = new Button("-");
    button.getStyleClass().clear();
    button.getStyleClass().add("actionbutton");
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            Stage stage = (Stage) ((Button) event.getSource()).getScene().getWindow();
            stage.setIconified(true);
        }
    });
    this.getChildren().add(button);
}

And I obviously called 我显然打电话给

primaryStage.initStyle(StageStyle.UNDECORATED);

The button is working well. 该按钮运行良好。

The issue is that when I try to maximize the Window once the Stage is iconified, it takes a couple of seconds for the Window to redraw the Stage. 问题是,当我在舞台被图标化后尝试最大化Window时,Window需要花费几秒钟来重新绘制舞台。

Any ideas on how to make the "Maximizing process" of the Window faster? 关于如何使Window的“最大化过程”更快的想法?

Fixed it by using 通过使用修复它

primaryStage.initStyle(StageStyle.TRANSPARENT);

instead of 代替

primaryStage.initStyle(StageStyle.UNDECORATED);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM