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

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