home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Internet / Java / ui / layout / example / BorderWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1978-03-06  |  1.3 KB  |  44 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Button;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.Frame;
  8. import java.awt.Window;
  9.  
  10. public class BorderWindow extends Frame {
  11.    private boolean inAnApplet = true;
  12.  
  13.    public BorderWindow() {
  14.       ((Container)this).setLayout(new BorderLayout());
  15.       ((Component)this).setFont(new Font("Helvetica", 0, 14));
  16.       ((Container)this).add("North", new Button("North"));
  17.       ((Container)this).add("South", new Button("South"));
  18.       ((Container)this).add("East", new Button("East"));
  19.       ((Container)this).add("West", new Button("West"));
  20.       ((Container)this).add("Center", new Button("Center"));
  21.    }
  22.  
  23.    public boolean handleEvent(Event var1) {
  24.       if (var1.id == 201) {
  25.          if (this.inAnApplet) {
  26.             ((Frame)this).dispose();
  27.             return true;
  28.          }
  29.  
  30.          System.exit(0);
  31.       }
  32.  
  33.       return super.handleEvent(var1);
  34.    }
  35.  
  36.    public static void main(String[] var0) {
  37.       BorderWindow var1 = new BorderWindow();
  38.       var1.inAnApplet = false;
  39.       ((Frame)var1).setTitle("BorderWindow Application");
  40.       ((Window)var1).pack();
  41.       ((Window)var1).show();
  42.    }
  43. }
  44.