package edu.csusb.danby.util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class InfoDialog extends JDialog{
    protected JButton button;	//OK button
    protected JLabel label;
    //protected JDialog frame;
    protected Container cp; //ContentPane

    public InfoDialog( String title, String message) {
        super();
        setTitle(title);
        cp = this.getContentPane();
        cp.setLayout(new BorderLayout(15,15));
        //frame=(JDialog)this;

        label = new JLabel(message);
        cp.add("Center",label);

        button = new JButton("OK");
        button.addActionListener( new ActionListener(){
        public void actionPerformed( ActionEvent e){
            InfoDialog.this.dispose();
            }
        });
        JPanel p = new JPanel();
        p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15));
        p.add(button);
        cp.add("South",p);
        this.pack();
        this.show();
    }

}
