Custom title bar in Javafx 2.0?

2019-02-19 10:16发布

Is there any tutorial on how to create custom title bar in javafx 2.0? I am creating a desktop GUI app and want to have a black gradient title bar with custom buttons for minimizing and closing. Here is the tutorial for WPF. I am looking for something similar for javafx

标签: javafx-2
2条回答
甜甜的少女心
2楼-- · 2019-02-19 10:21

I don't think it's possible to modify the title bar directly. One of the solution could be to remove the platform decorations and add your custom "title bar" to the top of your windows. Here for an example : JavaFX primaryStage remove windows borders?

查看更多
姐就是有狂的资本
3楼-- · 2019-02-19 10:23

To hide platform window:

stage.initStyle(StageStyle.UNDECORATED);

Now you can create your own titlebar/window-buttons & style them.

Finally, check "Ensemble" from Oracle JavaFX samples, they've done the exact thing: http://www.oracle.com/technetwork/java/javafx/samples/index.html

查看更多
登录 后发表回答