home *** CD-ROM | disk | FTP | other *** search
/ Java by Example / jbecd.bin / JBE-CD / NTUsers / JBECODE.ZIP / JavaByExample / chap23 / MenuFrameApplet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-03-07  |  948 b   |  29 lines

  1. import java.applet.Applet;
  2. import java.awt.Button;
  3. import java.awt.Container;
  4. import java.awt.Event;
  5.  
  6. public class MenuFrameApplet extends Applet {
  7.    MenuFrameFrame frame;
  8.    Button button;
  9.  
  10.    public void init() {
  11.       this.frame = new MenuFrameFrame("MenuBar Window");
  12.       this.button = new Button("Show Window");
  13.       ((Container)this).add(this.button);
  14.    }
  15.  
  16.    public boolean action(Event var1, Object var2) {
  17.       boolean var3 = this.frame.isShowing();
  18.       if (var3) {
  19.          this.frame.hide();
  20.          this.button.setLabel("Show Window");
  21.       } else {
  22.          this.frame.show();
  23.          this.button.setLabel("Hide Window");
  24.       }
  25.  
  26.       return true;
  27.    }
  28. }
  29.