// (c) MIT 2003.  All rights reserved.

// -*-Mode: Java-*- 
// MessageBox.java -- 
// Author: Christine Alvarado <calvarad@ai.mit.edu> 
// Maintainer: Christine Alvarado <calvarad@ai.mit.edu> 
// Version: 
// Created: <Sun Mar 12 13:35:53 2000> 
// Time-stamp: <2000-03-12 19:07:49 calvarad> 
// Keywords: 

package rec.util;

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

public class MessageBox extends Dialog
{
  public MessageBox( Dialog parent, String name, String message )
  {
    super( parent, name, true );

    Label l = new Label( message );
    Button b = new Button( "OK" );
    ActionListener al_ok = new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
	dispose();
      }
    };
    b.addActionListener( al_ok );
    
    add( b, BorderLayout.SOUTH );
    add( l, BorderLayout.NORTH );
    
    pack();

  }
  
  public MessageBox( Frame parent, String name, String message )
  {
    super( parent, name, true );

    Label l = new Label( message );
    Button b = new Button( "OK" );
    ActionListener al_ok = new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
	dispose();
      }
    };
    b.addActionListener( al_ok );
    
    add( b, BorderLayout.SOUTH );
    add( l, BorderLayout.NORTH );
    
    pack();
    
  }
}
