![](/img/trans.png)
[英]How to include files with NetBeans Platform Framework Application
[英]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平台框架上开发它时却不知道。
对于TinyLAF,这是我用于常规Swing应用程序的代码:
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将搜索以下网址:
请注意,我的问题不是如何更改NetBeans IDE的LookAndFeel,而是如何为基于NetBeans平台框架构建的Java应用程序执行此操作。
我发现以下搜索网:你需要在“安装程序”模块中进行搜索。 查看此链接以了解您需要添加的位置: http : //joshiegeek.blogspot.co.il/2012/01/netbeans-platform-custom-laf.html
这个有实际的代码示例(请忽略标题:)): http : //forums.netbeans.org/topic39450.html
最后这个谈到了一个特定的平台,但在此过程中几乎没有评论: https : //blogs.oracle.com/geertjan/entry/blue_look_and_feel_for
1.基于MVC架构,您可以非常轻松地更改Swing的外观和风格 。
2. Swing也称为PLAF
(Pluggable Look And Feel) ,因此保持相同的Model部件并更改View ,例如桌面和Web应用程序的相同模型。
3.使用
UIManager.setLookAndFeel(Your_Choice_of_Look_and_Feel); // To set the Look and Feel
SwingUtilities.updateComponentTreeUI(frame); // To refresh the JFrame and Components
有关详细信息,请参阅此
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
不得不在早期的帖子中找到关于回程机器的第一个链接......
答案是添加运行时参数或将其放在project.properties文件中。 要添加的行(例如Metal)是
run.args.extra=--laf javax.swing.plaf.metal.MetalLookAndFeel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.