给 Java 桌面应用程序换肤?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2248342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 20:17:49  来源:igfitidea点击:

Skinning Java desktop applications?

javaswingcustomizationlook-and-feelskin

提问by Hemeroc

Does anybody know a way to "skin" Java desktop applications. (Like Winamp skins, or skins for MirandaIM)? I don't want to create my own look and feel.

有没有人知道“皮肤”Java 桌面应用程序的方法。(比如 Winamp 皮肤,或 MirandaIM 的皮肤)?我不想创造自己的外观和感觉。

采纳答案by Jonas

Yes, there are a few ways this can be done, but I don't know anyone that is really simple. Have a look at Nimbus: The New Face of Swing, it contains a few examples. You can often override the look of components or just change the colors.

是的,有几种方法可以做到这一点,但我不知道有谁是真正简单的。看看Nimbus:Swing 的新面孔,它包含一些示例。您通常可以覆盖组件的外观或仅更改颜色。

Some links:

一些链接:

And you can always change to another LaF, in example Substance.

您可以随时更改为另一个 LaF,例如Substance

回答by Decker

We've successfully used the NimROD Look and Feelto 'skin' the Swing look & feel. It works well, has several 'themes' already written for it, and can be added in a few lines of code.

我们已经成功地使用NimROD 外观和感觉“设置”了 Swing 外观和感觉。它运行良好,已经为它编写了几个“主题”,并且可以在几行代码中添加。

回答by Peter

Swing has built-in dynamic look and feel support. If you are talking about desktop apps, you might want to start with Lesson: Modifying the Look and Feel.

Swing 具有内置的动态外观支持。如果您在谈论桌面应用程序,您可能想从课程:修改外观开始。

Edit: If you are talking about a webapp, then absolutely use different .cssto acheive a skinnable interface. CSS Zen Gardenis a great example/tutorial on how the same page can look entirely different with a different .cssfile.

编辑:如果你在谈论一个 webapp,那么绝对使用不同的.css来实现一个可换肤的界面。 CSS Zen Garden是一个很好的示例/教程,说明相同页面如何使用不同的.css文件看起来完全不同。