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

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