/* File: AboutDialog.java
 * Author: Jason Gookins
 * Description: This class creates the "About Belief" popup dialog.
 */

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class AboutDialog extends JDialog implements ActionListener
{
	/************************
	 ** Instance Variables **
	 ************************/

	private JButton okayButton;



	/**********************
	 ** Main Constructor **
	 **********************/

	public AboutDialog(JFrame parent)
	{
		super(parent, "About Belief", true);

		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		setPreferredSize(new Dimension(300, 250));
		setResizable(false);

		JPanel dialogPanel = new JPanel(null);

		ImageIcon beeLeaf = new ImageIcon("Belief.jpg", "Belief");
		JLabel imageLabel = new JLabel(beeLeaf, JLabel.CENTER);
		imageLabel.setBounds(10, 10, 127, 157);
		dialogPanel.add(imageLabel);

		JLabel infoLabel = new JLabel("<html>BeLIEF v0.1<br>WVU Modelling<br>Intelligence Lab<br>&copy;2008 GPL 3.0</html>", JLabel.CENTER);
		infoLabel.setBounds(160, 60, 100, 65);
		dialogPanel.add(infoLabel);

		okayButton = new JButton("OK");
		okayButton.setBounds(115, 180, 70, 30);
		okayButton.addActionListener(this);
		dialogPanel.add(okayButton);

		setContentPane(dialogPanel);

		pack();
		setLocationRelativeTo(parent);
		setVisible(true);
	}



	/*******************
	 ** Action Events **
	 *******************/

	public void actionPerformed(ActionEvent evt)
	{
		if (evt.getSource().equals(okayButton))
		{
			dispose();
		}
	}
}
