如何更改NetBeans平台框架应用程序的LookAndFeel [英] How to change the LookAndFeel of the NetBeans Platform Framework Application
问题描述
我不知道如何更改在NetBeans平台框架上构建的应用程序的LookAndFeel,请问有人可以帮忙吗?我想使用TinyLAF Java API http://www.muntjak来更改外观. de/hans/java/tinylaf/index.html .我知道在NetBeans IDE中开发常规的Swing应用程序时如何更改LookAndFeel,但在NetBeans Platform框架上开发时不知道如何更改.
I cannot figure out how to change the LookAndFeel of the application I built on the NetBeans platform framework, can anybody please help? I want to change its look using the TinyLAF java api http://www.muntjak.de/hans/java/tinylaf/index.html. I know how to change the LookAndFeel when developing a regular Swing application in the NetBeans IDE, but not when developing it on the NetBeans Platform framework.
这是我用于常规Swing应用程序的TinyLAF的代码:
This is the code, for TinyLAF, that I use for regular Swing applications:
Toolkit.getDefaultToolkit().setDynamicLayout(true);
System.setProperty("sun.awt.noerasebackground", "true");
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel");
} catch(Exception ex) {
ex.printStackTrace();
}
TinyLaF查找名为"Default.theme"(区分大小写)的默认主题文件.如果找到一个文件,则将在启动时加载该文件. ("Default.theme"文件是普通的TinyLaF .theme文件,只是具有特殊名称,您可以获取任何.theme文件并将其重命名为"Default.theme").
TinyLaF looks for a default theme file named 'Default.theme' (case-sensitive). If it finds one, this file will be loaded at startup. (The 'Default.theme' file is an ordinary TinyLaF .theme file, just with a special name, you can take any .theme file and rename it to 'Default.theme').
TinyLaF将搜索以下URL:
TinyLaF will search the following URLs:
- TinyLookAndFeel.class.getResource("/Default.theme");
- 找到"Default.theme"(如果它位于tinylaf.jar中)
- TinyLookAndFeel.class.getResource("/Default.theme");
- finds 'Default.theme' if it is inside tinylaf.jar
- 在应用程序的JAR中查找"Default.theme"
- 查找"Default.theme"是否位于主目录中
- 查找"Default.theme"(如果它位于工作目录中)
请注意,我的问题不是如何更改NetBeans IDE的LookAndFeel,而是如何针对基于NetBeans Platform框架构建的Java应用程序进行更改.
推荐答案
我在网上搜索了以下内容:您需要在安装程序"模块中进行此操作. 请在此链接中找到您需要添加的位置: http://joshiegeek.blogspot.co.il/2012/01/netbeans-platform-custom-laf.html
I found the following searching the net: you need to do it in the module "Installer". check this link for where you need to add: http://joshiegeek.blogspot.co.il/2012/01/netbeans-platform-custom-laf.html
这个有实际的代码示例(请忽略标题:)): http://forums.netbeans .org/topic39450.html
this one has actual code sample (please ignore the title :)) : http://forums.netbeans.org/topic39450.html
最后,这个人谈论了一个具体的问题,但是在此过程中几乎没有评论: https://blogs.oracle.com/geertjan/entry/blue_look_and_feel_for
and finally this one talks of a specific plaf but has few comments along the way : https://blogs.oracle.com/geertjan/entry/blue_look_and_feel_for
这篇关于如何更改NetBeans平台框架应用程序的LookAndFeel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!