The code snippet below describe how we can obtain the available look and feel in the current Swing platform. This 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.swing;
import javax.swing.UIManager;
public class AvailableLookAndFeel {
public static void main(String[] args) {
UIManager.LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeel : lookAndFeels) {
// Get the name of the look and feel
String name = lookAndFeel.getName();
System.out.println("Name = " + name);
// Get the implementation class for the look and feel
String className = lookAndFeel.getClassName();
System.out.println("ClassName = " + className);
}
}
}
Below is the list of available look and feel produces by the code snippet above.
Name = Metal
ClassName = javax.swing.plaf.metal.MetalLookAndFeel
Name = Nimbus
ClassName = javax.swing.plaf.nimbus.NimbusLookAndFeel
Name = CDE/Motif
ClassName = com.sun.java.swing.plaf.motif.MotifLookAndFeel
Name = Windows
ClassName = com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Name = Windows Classic
ClassName = com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
Latest posts by Wayan (see all)
- How do I create a table with multiple header in iText 8? - March 16, 2024
- How do I add Image to a Table in iText 8? - March 11, 2024
- How do I downgrade Android SDK emulator version? - February 12, 2024