How do I get the available swing look and feel?

Category: javax.swing, viewed: 838 time(s).

The code snippet below describe how we can obtain the available look and feel in the current swing platform. These information can then be made available to the user so they can change to look and feel of the application in their preferences.

 
package org.kodejava.example.swing;
 
import javax.swing.*;
 
public class AvailableLookAndFeel {
    public static void main(String[] args) {
        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);
        }
    }
}
 
 
Bookmark this example!  

Most Viewed Examples

Google

100 Top & Latest


eXTReMe Tracker
visitor stats