Missing titlebar on javafx app, with OpenJFX

2020-04-16 18:39发布

问题:

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?

回答1:

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'