简体   繁体   English

如何自定义 JFrame 上的标题栏?

[英]How can I customize the title bar on JFrame?

I would like to have a customized title bar in my Java Swing desktop application.我想在我的 Java Swing 桌面应用程序中有一个自定义的标题栏。 What is the best way to do that?最好的方法是什么? I can use a "Swing-title bar" by using the following code in the constructor for my JFrame:我可以通过在 JFrame 的构造函数中使用以下代码来使用“Swing-title bar”:

this.setUndecorated(true);
this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);

But how do I customize it?但是我如何自定义它? Is there any UI delegates that I can override or do I have to implement my own title bar from scratch?是否有我可以覆盖的UI 委托,或者我是否必须从头开始实现我自己的标题栏?

I want something like Lawson Smart Office:我想要像 Lawson Smart Office 这样的东西: 罗森智能办公

You can see an example in Substance look-and-feel ( mirrored source ).您可以在Substance 外观镜像源)中看到一个示例。 Search the code for SubstanceRootPaneUI and SubstanceTitlePane.搜索 SubstanceRootPaneUI 和 SubstanceTitlePane 的代码。 The implementation depends on other classes in Substance, and will not be easy to reuse outside the specific library - nor is it meant to.实现依赖于 Substance 中的其他类,并且不容易在特定库之外重用 - 也不是故意的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM