Adding look and feel into java application
-
20-09-2019 - |
Question
I am working with the NetBeans 6.5 IDE.
I downloaded a look and feel jar file and added it NetBeans by palette manager.
How do I use it in my application?
Solution 2
Thanks for your reply. By using the below code we can get all look and feel class names.
UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels();
for (int i = 0; i < lookAndFeelInfos.length; i++) {
UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i];
//
// Get the name of the look and feel
//
String name = lookAndFeelInfo.getName();
System.out.println("name = " + name);
//
// Get the implementation class for the look and feel
//
String className = lookAndFeelInfo.getClassName();
System.out.println("className = " + className);
}
OTHER TIPS
You can follow this Sun tutorial about setting the L&F in Java
You can change the L&F with
setLookAndFeel
even after the program's GUI is visible.
To make existing components reflect the new L&F, invoke theSwingUtilities
updateComponentTreeUI
method once per top-level container.
Then you might wish to resize each top-level container to reflect the new sizes of its contained components. For example:
UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow