如何隐藏Mac OS窗口的全屏按钮(在JavaFX中)? [英] How to hide full screen button of Mac OS window (in JavaFX)?

查看:410
本文介绍了如何隐藏Mac OS窗口的全屏按钮(在JavaFX中)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mac OS的每个窗口标题栏右上角都有一个全屏按钮。有没有办法在JavaFX中隐藏Mac OS的默认全屏按钮?

Every window title bar of Mac OS has a full screen button at the top-right corner.Is there any way to hide this default full screen button of Mac OS in JavaFX?

此处是我的代码片段:

    public static void  launchOkMessageBox(){
    pane  = new VBox();
    scene = new Scene(pane,150,60, Color.GHOSTWHITE);
    Label label  = new Label("Hello Word");
    Button okButton = new Button("Ok");

    pane.getChildren().add(label);
    pane.getChildren().add(okButton);
    pane.setAlignment(Pos.CENTER);
    pane.setSpacing(10);


    messageBoxStage.setScene(scene);
    messageBoxStage.setResizable(false);
    messageBoxStage.sizeToScene();
    messageBoxStage.show();

    okButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {

            messageBoxStage.close();
        }
    });
}


推荐答案

至少对于新对话框API 已经足够拥有窗口模态设置为 APPLICATION_MODAL (默认值):

At least for the new dialog API it is sufficient have an owning Window with modality set to APPLICATION_MODAL (default):

Alert alert = new Alert();
alert.initOwner(mainStage);

这篇关于如何隐藏Mac OS窗口的全屏按钮(在JavaFX中)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆