简体   繁体   中英

How to use custom look and feel for Swing application?

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM