i have downloaded a Look And Feel in form of jar file. now i have to use it and apply it on my GUI application i have developed using swing. i m using net beans , when i right click on mt frames , an option comes PREVIEW DESIGN where different LOOK AND FEEL comes in option to select and check the preview , how do i add my downloaded L&F there n check my preview frame ?? and next question is how do i apply it to my application ?? i have the downloaded jar file of the look and feel.
Asked
Active
Viewed 311 times
1 Answers
1
I don't know how to change the look and feel through Netbeans' help.
You can do it manually. First Add the jar to the classpath (I don't know the steps to do it in Netbeans). Then invoke the following code in your main method before displaying any Swing component:
import javax.swing.UIManager.*;
try {
UIManager.setLookAndFeel( "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
// If the look and feel is not available, do nothing.
}
Replace the String with the full path of your new look and feel's class.

Igor Rodriguez
- 1,196
- 11
- 16
-
where to add ?? which classPath ?? i m new to this ! please elaborate ! – Vinit Jain Sep 30 '13 at 22:33
-
@VinitJain: For adding a jar to the classpath in Netbeans: http://stackoverflow.com/questions/7598623/how-to-setup-classpath-in-netbeans – Igor Rodriguez Oct 01 '13 at 07:05
-
@VinitJain: For a definition of what the classpath is: https://en.wikipedia.org/wiki/Classpath_%28Java%29 – Igor Rodriguez Oct 01 '13 at 07:07