/* File: Belief.java
 * Author: Jason Gookins
 * Description: The main class of Belief that controls the
 * main window and runs a new instance of the program.
 */

import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.UIManager;

public class Belief extends JFrame
{
	/**********************
	 ** Main Constructor **
	 **********************/

	public Belief()
	{
		initLookAndFeel();

		ImageIcon icon = new ImageIcon(ClassLoader.getSystemResource("belief.ico"));

		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setPreferredSize(new Dimension(800, 600));
		this.setMinimumSize(new Dimension(800, 600));
		this.setTitle("Belief");
		this.setIconImage(icon.getImage());

		BeliefListener beliefListener = new BeliefListener();

		BeliefMenuBar beliefMenuBar = new BeliefMenuBar(beliefListener);
		this.setJMenuBar(beliefMenuBar);

		ContentPane contentPane = new ContentPane(beliefListener);
		this.setContentPane(contentPane);

		beliefListener.setListensTo(beliefMenuBar, contentPane);

		this.pack();
		this.setVisible(true);
	}



	/*****************
	 ** Main Method **
	 *****************/

	public static void main(String[] args)
	{
		javax.swing.SwingUtilities.invokeLater(new Runnable()
		{
			public void run()
			{
				Belief newBelief = new Belief();
			}
		});
	}



	/********************
	 ** Helper Methods **
	 ********************/

	/* Sets the look and feel of the application */
	private void initLookAndFeel()
	{
		String lookAndFeel = UIManager.getSystemLookAndFeelClassName();

		try
		{
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} 
		catch (Exception e)
		{
			try
			{
				UIManager.setLookAndFeel(lookAndFeel);
			}
			catch (Exception f)
			{
				System.out.println("There seems to be an error.");
			}
		}

	}
}