给 Java 桌面应用程序换肤?
有谁知道一种“皮肤”Java 桌面应用程序的方法吗? (例如 Winamp 皮肤或 MirandaIM 皮肤)? 我不想创造自己的外观和感觉。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
是的,有几种方法可以做到这一点,但我不知道有谁是真正简单的。看看 Nimbus:Swing 的新面貌,它包含一些示例。您通常可以覆盖组件的外观或仅更改颜色。
一些链接:
并且您可以随时更改为另一个 LaF,例如 物质。
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.
Some links:
And you can always change to another LaF, in example Substance.
我们已成功使用 NimROD 外观 为 Swing 外观“换肤” ;感觉。它运行良好,已经为其编写了几个“主题”,并且可以通过几行代码添加。
We've successfully used the NimROD Look and Feel to '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.
对于 2022 年仍在积极维护并允许 Swing 应用程序换肤的项目,请尝试 FlatLaf
For a project that's still actively maintained in 2022 and allows skinning of Swing applications try FlatLaf
Swing 具有内置的动态外观支持。如果您正在谈论桌面应用程序,您可能需要从课程:修改外观开始和感觉。
编辑:如果您谈论的是 Web 应用程序,那么绝对使用不同的
.css
来实现可换肤界面。 CSS Zen Garden 是一个很好的示例/教程,说明同一页面如何使用不同的.css
文件。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.
Edit: If you are talking about a webapp, then absolutely use different
.css
to acheive a skinnable interface. CSS Zen Garden is a great example/tutorial on how the same page can look entirely different with a different.css
file.2022 年维护的另一个现代外观和感觉是 https://github.com/vincenzopalazzo/material- ui-swing
它还包括一种在外部 jar 中开发自定义主题的方法,例如这个 https://github.com/material-ui-swing/DarkStackOverflowTheme
Another modern look and feel active maintained in 2022 is https://github.com/vincenzopalazzo/material-ui-swing
It include also a way to develop a custom theme in an external jar, like this one https://github.com/material-ui-swing/DarkStackOverflowTheme