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

import java.awt.*;
import java.awt.event.*;
import java.io.PrintStream;

public class ShowMessage
    implements ActionListener
{
    static class MyWindowCloser extends WindowAdapter
    {

        public void windowClosing(WindowEvent windowevent)
        {
            winToClose.dispose();
        }

        Dialog winToClose;

        MyWindowCloser(Dialog dialog)
        {
            winToClose = dialog;
        }
    }


    ShowMessage(Component component, String s, String s1, boolean flag)
    {
        message = "Title";
        title = "Message";
        modal = false;
        obj = component;
        message = s;
        title = s1;
        modal = flag;
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        if (dlg != null)
            dlg.dispose();
    }

    public void dispose()
    {
        if (dlg == null)
        {
            return;
        } else
        {
            dlg.dispose();
            dlg = null;
            return;
        }
    }

    public void show()
    {
        for (; !(obj instanceof Frame); obj = obj.getParent())
            if (obj == null)
                return;

        if (!(obj instanceof Frame))
        {
            System.out.println(title + " : " + message);
            return;
        } else
        {
            dlg = new Dialog((Frame)obj, title, modal);
            dlg.setSize(400, 300);
            Button button = new Button("OK");
            button.addActionListener(this);
            dlg.add(button, "South");
            TextArea textarea = new TextArea(message, 0, 0, 1);
            dlg.add(textarea, "Center");
            dlg.addWindowListener(new MyWindowCloser(dlg));
            dlg.setVisible(true);
            return;
        }
    }

    private Dialog dlg;
    private Component obj;
    private String message;
    private String title;
    private boolean modal;
}
