// SlateApp.java
package version1;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import slate.Slate;

/**
 * The main application class.
 * @author Ramnivas Laddad
 */
public class SlateApp {
    private Slate _slate = new Slate();
    private SlateAppMenuBar _menuBar = new SlateAppMenuBar(_slate);

    /**
     * Private constructor.
     * This class is expected to be created from the main() and this
     * private constructor prohibits creating this class from anywhere
     * else.
     */
    private SlateApp() {
	_slate.setForeground(Color.black);
	_slate.setBackground(Color.white);

	JFrame frame = new JFrame("Slate Application");
	frame.getContentPane().add(_slate);
	frame.setJMenuBar(_menuBar);
	frame.setSize(400, 400);
	frame.addWindowListener(new WindowAdapter(){
	    public void windowClosing(WindowEvent e) {
		System.exit(0);
	    }});
	frame.setVisible(true);
    }

    /**
     * The main function.
     * It simply creates a new object of SlateApp. All the real work 
     * happens inside the contructor.
     */
    public static void main(String[] args) {
	new SlateApp();
    }
}