JavaFX全屏独占模式 [英] JavaFX Full Screen Exclusive Mode

查看:915
本文介绍了JavaFX全屏独占模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个JavaFX自助服务终端应用程序,需要完全控制屏幕并禁止关闭,最小化和某些按键。我想知道有没有办法让JavaFX应用程序以全屏独占模式运行,如果没有,有任何替代方案可以实现相同的目标。我尝试过使用:

I am making a JavaFX kiosk application that needs to take full control of the screen and disallow closing, minimising, and certain keypresses. I was wondering is there a way to make a JavaFX application run in full screen exclusive mode, if not are there any alternatives that could achieve the same goal. I have tried using:

stage.setFullScreen(true);

成功使应用程序全屏显示,但用户仍然可以退出应用程序或完全退出屏幕。

which does successfully make the application full screen, however the user can still exit the application or exit the full screen.

推荐答案

处理关闭事件。

以下代码可能有所帮助!

following code may help!

//设置平台参数
Platform.setImplicitExit(false);

// Set plat params Platform.setImplicitExit(false);

primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
    @Override
    public void handle(WindowEvent event) {
// deque it
        event.consume();
    }
});

这篇关于JavaFX全屏独占模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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