import javax.swing.*; import java.awt.event.*; import java.awt.*; public class LAFTest extends JFrame { JComboBox c = new JComboBox(); JTextField t = new JTextField(30); LAFTest outermostWindow = this; public static void main(String[] args) { LAFTest frame = new LAFTest(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 80); frame.setVisible(true); } public LAFTest() { final UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < lafs.length; ++i) { c.addItem(lafs[i].getName()); } t.setEditable(false); c.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ JComboBox box = (JComboBox)e.getSource(); for (int i = 0; i < lafs.length; ++i) { if (lafs[i].getName() == box.getSelectedItem().toString()) try { UIManager.setLookAndFeel(lafs[i].getClassName()); t.setText(lafs[i].getClassName()); } catch (Exception exc) { System.err.println("Error loading " + lafs[i].getClassName() + ": " + exc); } } SwingUtilities.updateComponentTreeUI(outermostWindow); } }); Container cp = getContentPane(); cp.setLayout(new FlowLayout()); cp.add(t); cp.add(c); } } // class LAFTest