如何自定义 JFrame 上的标题栏? [英] How can I customize the title bar on JFrame?

查看:37
本文介绍了如何自定义 JFrame 上的标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的 Java Swing 桌面应用程序中有一个自定义的标题栏.最好的方法是什么?我可以通过在 JFrame 的构造函数中使用以下代码来使用Swing-title bar":

I would like to have a customized title bar in my Java Swing desktop application. 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:

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

但是我如何自定义它?是否有任何UI 委托 可以覆盖或我必须从头开始实现我自己的标题栏?

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?

我想要 Lawson Smart Office 之类的东西:

I want something like Lawson Smart Office:

推荐答案

你可以在 中看到一个例子物质外观(镜像来源).搜索 SubstanceRootPaneUI 和 SubstanceTitlePane 的代码.实现依赖于 Substance 中的其他类,并且不容易在特定库之外重用 - 也不是故意的.

You can see an example in Substance look-and-feel (mirrored source). Search the code for SubstanceRootPaneUI and 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.

这篇关于如何自定义 JFrame 上的标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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