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

查看:372
本文介绍了如何在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这样的东西办公室:

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天全站免登陆