home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / WDESAMPL.BIN / DemoApplet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-03-13  |  1.5 KB  |  48 lines

  1. import java.applet.Applet;
  2. import java.awt.Button;
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Frame;
  7. import java.awt.Window;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10.  
  11. public abstract class DemoApplet extends Applet implements ActionListener {
  12.    private Button demoButton;
  13.    private Frame demoFrame;
  14.  
  15.    public abstract Frame createDemoFrame(DemoApplet var1);
  16.  
  17.    public void init() {
  18.       ((Component)this).setBackground(Color.white);
  19.       this.demoButton = new Button("Demo");
  20.       this.demoButton.addActionListener(this);
  21.       this.demoButton.setBackground(Color.yellow);
  22.       ((Container)this).add(this.demoButton);
  23.    }
  24.  
  25.    public static void showDemo(Frame var0) {
  26.       ((Component)var0).setSize(550, 500);
  27.       ((Window)var0).show();
  28.    }
  29.  
  30.    public void demoClosed() {
  31.       this.demoFrame = null;
  32.    }
  33.  
  34.    public void actionPerformed(ActionEvent var1) {
  35.       String var2 = var1.getActionCommand();
  36.       if (var2.equals("Demo")) {
  37.          this.demoButton.setLabel("loading");
  38.          if (this.demoFrame == null) {
  39.             this.demoFrame = this.createDemoFrame(this);
  40.             showDemo(this.demoFrame);
  41.          }
  42.  
  43.          this.demoButton.setLabel("Demo");
  44.       }
  45.  
  46.    }
  47. }
  48.