Reputation: 1446
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.
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 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 will search the following URLs:
Please note that my question is not how to change the LookAndFeel of the NetBeans IDE, but how to do it for the Java Application built on top of NetBeans Platform framework.
Upvotes: 2
Views: 3254
Reputation: 3018
Had to find that first link mentioned in an earlier post on the waybackmachine ...
Answer is to add a runtime argument or put it in the project.properties file. The line to add (for e.g. Metal) is
run.args.extra=--laf javax.swing.plaf.metal.MetalLookAndFeel
Upvotes: 0
Reputation:
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
this one has actual code sample (please ignore the title :)) : http://forums.netbeans.org/topic39450.html
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
Upvotes: 2
Reputation: 33534
1. You can change the look and feel of Swing very easily as its based on MVC architecture.
2. Swing is also known as PLAF
(Pluggable Look And Feel), so keep the same Model part and change the View, example like same model for desktop and web application.
3. Use
UIManager.setLookAndFeel(Your_Choice_of_Look_and_Feel); // To set the Look and Feel
SwingUtilities.updateComponentTreeUI(frame); // To refresh the JFrame and Components
See this for more details:
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
Upvotes: 1