home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Frame;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
-
- public abstract class DemoApplet extends Applet implements ActionListener {
- private Button demoButton;
- private Frame demoFrame;
-
- public abstract Frame createDemoFrame(DemoApplet var1);
-
- public void init() {
- ((Component)this).setBackground(Color.white);
- this.demoButton = new Button("Demo");
- this.demoButton.addActionListener(this);
- this.demoButton.setBackground(Color.yellow);
- ((Container)this).add(this.demoButton);
- }
-
- public static void showDemo(Frame var0) {
- ((Component)var0).setSize(550, 500);
- ((Window)var0).show();
- }
-
- public void demoClosed() {
- this.demoFrame = null;
- }
-
- public void actionPerformed(ActionEvent var1) {
- String var2 = var1.getActionCommand();
- if (var2.equals("Demo")) {
- this.demoButton.setLabel("loading");
- if (this.demoFrame == null) {
- this.demoFrame = this.createDemoFrame(this);
- showDemo(this.demoFrame);
- }
-
- this.demoButton.setLabel("Demo");
- }
-
- }
- }
-