问题
How to use custom look and feel jar files in Java project For Ex: Seaglass look and feel?
What are the required steps to successfully use any look and feel jar our project and how to add jar file to class path?
回答1:
I am gonna use seaglass look and feel jar file to explain the answer, you can download the same here
Step 1: First add the downloaded look and feel to your project classpath
Right click on your project in eclipse, go to Build path and select configure build path, Under Libraries tab choose Add External Jar and find your Jar file (seaglass jar file in this case). On pressing Ok it shoud appear under Referenced Libraries of your project.
Step 2: Register LookAndFeel class with UIManager
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
Add this code in the JFrame Class constructor. for other look and feel jar file replace "com.seaglasslookandfeel.SeaGlassLookAndFeel" in the code its look and feel class (google it if you cant find).
You are done, Run your project and there you see the look and Feel you wanted,, Enjoy
来源:https://stackoverflow.com/questions/22008971/how-to-use-custom-look-and-feel-for-swing-application