import java.awt.*;
import java.awt.event.*;

/**
  *This is the dialog shown when the game is lost
  */
public class LostDialog extends Dialog implements ActionListener {
       protected Frame _theFrame;
       protected Button _theButton;

	/**
	  *Constructor
	  *@param frame The parent that "owns" the dialog window
	  *@param str Stringthat will be displayed in the dialog
	  *@param modal If true thsi is a modal dialog (Everything else is blocked)
	  */
       public LostDialog(Frame frame, String str, boolean modal) {
           super (frame, str, true);
           _theButton = new Button("OK");
           _theButton.setSize(70,50); 
           _theButton.addActionListener(this);
           setSize(150,150);
           setLayout(new FlowLayout(FlowLayout.CENTER, 3, 50)) ;
           add(_theButton);
           setVisible(true);
       }
 
	/**
	  *Method called by the ActionListener when an event is caught
	  *System.exit now requires special permission in the java.policy file
	  *post: program terminates at this point 
	  */
       public void actionPerformed(ActionEvent e) {
           Object source = e.getSource();  
           if (source == _theButton) 
              System.exit(0); 
       } 

}

