
// AlertDialog class
// ================

import java.awt.*;
import java.awt.event.*;

public class AlertDialog extends Dialog implements WindowListener,
	ActionListener
{
	protected Button button;
	protected Label label;

	public AlertDialog(Frame parent, String message)
	{
		super(parent,"ALERT",false);

		this.setLayout(new BorderLayout(15,15));

		label = new Label(message);
		this.add("Center",label);

		button = new Button("Okay");
		Panel p = new Panel();
		p.setLayout(new FlowLayout(FlowLayout.CENTER,15,15));
		p.add(button);

		button.addActionListener(this);
		this.add("South",p);

		this.pack();
		this.show();
	}

	public void actionPerformed (ActionEvent event)
	{
		if (event.getSource() == button)
		{
			this.setVisible(false);
			this.dispose();
		}
	} // end of method "actionPerformed"

	public void windowOpened(WindowEvent event) {}
        public void windowIconified(WindowEvent event) {}
        public void windowDeiconified(WindowEvent event) {}
        public void windowClosed(WindowEvent event) {}
        public void windowActivated(WindowEvent event) {}
        public void windowDeactivated(WindowEvent event) {}

	public void windowClosing(WindowEvent event)
	{
	dispose();
	} // end of method "windowClosing"

} // end class "AlertDialog"


