使用OpenJFX的javafx应用程序上缺少标题栏 [英] Missing titlebar on javafx app, with OpenJFX

查看:243
本文介绍了使用OpenJFX的javafx应用程序上缺少标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用OpenJDK 11和OpenJFX构建应用程序.它可以正常编译并启动,但是没有标题栏,并且如果我单击应用程序边缘附近,则将其注册为单击该窗口后面的任何窗口.

我正在使用IntelliJ IDEA,花了一些时间才弄清楚如何甚至将OpenJFX与它一起使用.无论如何,这是系统详细信息:

我正在运行基本OS 5.0 Juno(基于Ubuntu 18.04,一切都是GTK) 迅速安装了IntelliJ IDEA(Community)2018. 可从此处下载OpenJFX SDK:来自Gluon的OpenJFX

我刚刚制作了一个新的JavaFX应用程序,并将dir/javafx-sdk-11.0.1/lib/添加到外部库中,然后运行->编辑配置并添加了VM选项--module-path <path>/javafx-sdk-11.0.1/lib --add-modules=javafx.controls,javafx.fxml,javafx.base

控制器和所有内容似乎都可以正常工作,但是出现的窗口如下所示:

有人知道我在做什么错吗?

解决方案

感谢JoséPereda

正是修复它的原因.请参阅他链接的问题以获取详细信息:存在的问题gtk3和javafx

无论如何,在intelliJ中,可以通过运行->配置并将-Djdk.gtk.version=2添加到"VM选项"中来解决此问题

I'm currently building an application with OpenJDK 11 and OpenJFX. It compiles just fine, and starts, but there is no titlebar, and if I click close to the edge of the app, it registers as a click on whatever window is behind it.

I am using IntelliJ IDEA, and it took a while to figure out how to even use OpenJFX with it. Anyhow, here's the system details:

I'm running elementary OS 5.0 Juno (based off of Ubuntu 18.04, everything is GTK) IntelliJ IDEA (Community) 2018 installed as a snap. OpenJFX SDK downloaded from here: OpenJFX from Gluon

I've just made a new JavaFX app, and added the dir /javafx-sdk-11.0.1/lib/ to external libraries, and then went to run -> edit configurations and added VM options --module-path <path>/javafx-sdk-11.0.1/lib --add-modules=javafx.controls,javafx.fxml,javafx.base

The controller and everything seems to work, but the resulting window looks like this:

Does someone know just what I'm doing wrong here?

解决方案

Thanks to José Pereda

It was exactly that which fixed it. See the question he linked for details: problems with gtk3 and javafx

Anyhow, in intelliJ it's solved by going to Run -> Configurations and adding -Djdk.gtk.version=2 to the 'VM Options'

这篇关于使用OpenJFX的javafx应用程序上缺少标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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