// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) fieldsfirst 
// Source File Name:   MessageBox.java

package lt.monarch.awt;

import java.awt.*;

// Referenced classes of package lt.monarch.awt:
//			TextLabel

public class MessageBox extends Dialog
{

	public MessageBox(String s, String s1)
	{
		super(new Frame(), s, true);
		GridBagLayout gridbaglayout = new GridBagLayout();
		GridBagConstraints gridbagconstraints = new GridBagConstraints();
		setLayout(gridbaglayout);
		TextLabel textlabel = new TextLabel(s1);
		gridbagconstraints.insets = new Insets(5, 5, 5, 5);
		gridbagconstraints.weightx = 1.0D;
		gridbagconstraints.weighty = 1.0D;
		gridbagconstraints.fill = 1;
		gridbagconstraints.gridheight = 2;
		gridbaglayout.setConstraints(textlabel, gridbagconstraints);
		add(textlabel);
		Button button = new Button("Ok");
		gridbagconstraints.insets = new Insets(5, 0, 5, 5);
		gridbagconstraints.weightx = 0.0D;
		gridbagconstraints.weighty = 0.0D;
		gridbagconstraints.ipadx = getToolkit().getScreenSize().width / 20;
		gridbagconstraints.fill = 2;
		gridbagconstraints.anchor = 11;
		gridbagconstraints.gridheight = 1;
		gridbaglayout.setConstraints(button, gridbagconstraints);
		add(button);
		pack();
		centerOnScreen();
	}

	public boolean action(Event event, Object obj)
	{
		dispose();
		return true;
	}

	protected void centerOnScreen()
	{
		Dimension dimension = getToolkit().getScreenSize();
		dimension.width -= bounds().width;
		dimension.height -= bounds().height;
		move(dimension.width / 2, dimension.height / 2);
	}

	public boolean handleEvent(Event event)
	{
		if(event.id == 201)
		{
			dispose();
			return true;
		} else
		{
			return super.handleEvent(event);
		}
	}
}
