// written by Kandice A. Null to support Friendly's Puzzle 5/2/96 import java.awt.*; public class PuzWindow extends Dialog { protected Button button; protected TextArea text; protected MenuBar menbar; protected Menu men; public PuzWindow(Frame f,String title, String message) { super(f,title,false); this.resize(400,200); text = new TextArea(); this.setLayout (new BorderLayout()); this.add("Center", text); menbar = new MenuBar(); men = new Menu("Options",true); men.add(new MenuItem ("Close")); men.add(new MenuItem ("Quit")); menbar.add(men); menbar.setHelpMenu(men); //setMenuBar(menbar); this.pack(); } public boolean action (Event e, Object what) { if (e.target instanceof MenuItem) { String l = (String)what; if (l.equals("Close")) { if (this.isShowing()) this.hide(); } else if (l.equals("Quit")) { this.hide(); this.dispose(); } return true; } else return false; } // below from Dr. Roger Webster from class handout 4/30/96 public void write_msg(String message) { text.setText(message); this.show(); } public void kill() { this.hide(); this.dispose(); } }