有没有办法让 Nimbus Look&Feel 为顶级 JFrame 渲染自己的窗户装饰?

2022-01-24 00:00:00 java swing look-and-feel jframe nimbus

有没有办法让 Nimbus Look&Feel 为顶级 JFrame 渲染自己的窗口装饰?我一直在互联网上挖掘,我开始怀疑这可能根本不可能.有没有人真正成功(并关心)这个?

Is there a way to have the Nimbus Look&Feel render its own windows decorations for a top level JFrame? I've been digging through the Internet, and I'm starting to suspect it might not be possible at all. Has anyone actually succeeded with (and cared about) that?

Nimbus 装饰对于 内部框架 来说是漂亮而整洁的,但是显然没有办法对 JFrameJDialogs.

Nimbus decorations are nice and neat for internal frames, but apparently there is no way to have the same effect on JFrames and JDialogs.

我尝试了 nimbusx(Nimbus Extensions),一个子类化的库JFrameJDialog 并据称将 nimbus 样式的装饰应用于它们(然后您只需实例化 nimbusx 类而不是 JFrameJDialog);但它实际上不起作用,并且自 2009 年以来一直处于非活跃的 alpha 阶段.

I tried nimbusx (Nimbus Extensions), a library that subclasses JFrame and JDialog and allegedly applies nimbus-styled decorations to them (then you just have to instantiate nimbusx classes instead of JFrame and JDialog); but it actually doesn't work, and it's been in an inactive alpha stage since 2009.

那么,有没有人通过让 Nimbus LAF 处理窗口装饰,成功地让他们的 nimbus 风格的 Java 应用程序在所有平台上看起来都保持一致?

So, did anyone succeeded in having their nimbus-styled Java application look consistent on all platforms by having the Nimbus LAF take care of window decorations?

推荐答案

我已经用 JGoodies Looks 过去.我不知道 Nimbus 是否支持.

I've done this with JGoodies Looks in the past. I don't know if Nimbus supports it or not.

它不仅是 LAF,而且是您必须以编程方式为 JFrame(和 JDialog,如果需要)打开的选项.

It's not only the LAF, however, it is an option you must programmatically turn on for JFrame (and JDialog if you want).

JFrame.setDefaultLookAndFeelDecorated( true );
JDialog.setDefaultLookAndFeelDecorated( true );

请参阅 API 文档

相关文章