// File: AboutDialog.java
// Classes: AboutDialog
// Author: Kedar Patankar

package edu.neu.ccs.demeter.tools.apstudio.graphedit;

import java.awt.Button;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.BorderLayout;
import java.awt.Event;
import java.awt.Font;
import java.awt.Color;
import java.awt.Point;
import java.awt.Dimension;
import java.awt.Dialog;
import java.awt.Panel;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;

/** This class pops up the dialog showing information about APStudio. It displays the author, contact information
and version number*/

public class AboutDialog extends Frame implements ActionListener 
//public class AboutDialog extends Dialog implements ActionListener 
{
	
	public AboutDialog(Frame frame,String title) 
	{ 
		super(title);
		//super(frame,title,true);
		setLayout(new BorderLayout());

		TextArea aboutLabel;

		String about = "Thank you for using ApStudio Software(Version 0.6). \n\n" + 
			"This product is being developed at the \n" +
			"College of Computer Science, Northeastern University. \n" +
			"Send any Questions or Comments to : \n"+
			"Kedar Patankar \n" +
			"E-mail kedar@ccs.neu.edu. \n" +
			"URL : http://www.ccs.neu.edu/home/kedar. \n " ;

		aboutLabel=new TextArea(about);
		aboutLabel.setFont(new Font("Times Roman",Font.BOLD,12));
		aboutLabel.setEditable(false);
		aboutLabel.setBackground(Color.lightGray);
		add("Center",aboutLabel);
		

		Panel buttonPanel = new Panel();
		Button _execute = new Button("Ok");
		_execute.addActionListener(this); // jdk 1.1
		buttonPanel.add(_execute);
		buttonPanel.setBackground(Color.lightGray);
		add("South",buttonPanel);
		pack();
// jdk 1.1 type window event handling
		addWindowListener(new ADAdapter()); // using inner class for window handling.
	}
	
/*	public void setVisible(boolean status)
	{
		if(status)
		{
			Dimension frameSize = getParent().getSize();
			Point     frameLoc  = getParent().getLocation();
			Dimension mySize    = getSize();
			int       x,y;

			x = frameLoc.x + (frameSize.width/2) -(mySize.width/2); 
			y = frameLoc.y + (frameSize.height/2)-(mySize.height/2); 
			setBounds(x,y,getSize().width,getSize().height);
			super.setVisible(true);
		}
		else
			super.setVisible(false);
	}
*/
	private void close() { setVisible(false); dispose(); }

// Event handling	
	
	public void actionPerformed(ActionEvent event)
	{
		close();
	}

/** inner class VDAdapter
This class is responsible for handling window events. WindowClose is only important for us*/
	class ADAdapter extends WindowAdapter
	{
		public void windowClosing(WindowEvent event)
		{
			close();
		}
	}
} /* end class AboutDialog */

