// Purpose. Query, get, and set Swing LookAndFeel import javax.swing.*; public class LAF { public static void main( String[] args ) { UIManager.LookAndFeelInfo[] lfInfo = UIManager.getInstalledLookAndFeels(); System.out.println( "Installed look-and-feels are:" ); for (int i = 0; i < lfInfo.length; i++) System.out.println("name: " + lfInfo[i].getName() + ",\t class: " + lfInfo[i].getClassName()); LookAndFeel laf = UIManager.getLookAndFeel(); System.out.println( "\ncurrent LAF is " + laf.getName() ); System.out.print( "Choose a look-and-feel - " ); for (int i=0; i < lfInfo.length; i++) System.out.print( "(" + i + ") "+ lfInfo[i].getName() + " - " ); int ans = Read.anInt(); try { UIManager.setLookAndFeel( lfInfo[ans].getClassName() ); } catch (Exception ex) { System.out.println( ex ); } laf = UIManager.getLookAndFeel(); System.out.println( "current LAF is " + laf.getName() ); System.exit( 0 ); } } // Installed look-and-feels are: // name: Metal, class: javax.swing.plaf.metal.MetalLookAndFeel // name: CDE/Motif, class: com.sun.java.swing.plaf.motif.MotifLookAndFeel // name: Windows, class: com.sun.java.swing.plaf.windows.WindowsLookAndFeel // // current LAF is Metal // Choose a look-and-feel - (0) Metal - (1) CDE/Motif - (2) Windows - 1 // current LAF is CDE/Motif // \jdk1.2\jre\lib\swing.properties - // swing.defaultlaf = javax.swing.plaf.metal.MetalLookAndFeel // #swing.defaultlaf = com.sun.java.swing.plaf.motif.MotifLookAndFeel // #swing.defaultlaf = com.sun.java.swing.plaf.windows.WindowsLookAndFeel