package lookandfeel;

import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.metal.*;

import gui.*;

/**
 * An example that illustrates the use of themes
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison University
 */
public class ThemeDemo
{

    /**
     * The entry point
     */
    public static void main(String[] args)
    {
	CloseableFrame               f;
	JComponent                   contentPane;
	JListEditor                  jle;
	JMUTheme                     theme;


	f = new CloseableFrame();

	// Set the theme
	theme = new JMUTheme();
	MetalLookAndFeel.setCurrentTheme(theme);
	


	// Re-load the look-and-feel
	try {

	    UIManager.setLookAndFeel(
			       "javax.swing.plaf.metal.MetalLookAndFeel");

	} catch (ClassNotFoundException cnfe) {
	    
	    System.out.println("Couldn't set look and feel");
	    
	} catch (InstantiationException ie) {
	    
	    System.out.println("Couldn't set look and feel");
	    
	} catch (IllegalAccessException ie) {
	    
	    System.out.println("Couldn't set look and feel");
	    
	} catch (UnsupportedLookAndFeelException ie) {
	    
	    System.out.println("Couldn't set look and feel");
	}


	contentPane = (JComponent)(f.getContentPane());
	contentPane.setLayout(new BorderLayout());

	jle = new JListEditor();
	contentPane.add(jle, BorderLayout.CENTER);
	SwingUtilities.updateComponentTreeUI(f);

	f.setSize(400,300);
	f.setVisible(true);

    }
}
