home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.0 KB | 50 lines |
-
- package spt.applet_drivers;
-
- import java.awt.*;
- import java.util.*;
- import java.applet.*;
-
- import spt.applets.StdApplet;
- import spt.applets.ImageButtonApplet;
- import spt.gui.ImageButton;
-
-
- public class ImageButtonAppletDriver extends StdApplet {
-
- ImageButton button;
- Checkbox en, dis;
- String targetName;
-
- public void init() {
- super.init();
-
- setLayout(new GridLayout(2, 1, 0, 0));
-
- CheckboxGroup g = new CheckboxGroup();
- add(en = new Checkbox("Enabled", g, true));
- add(dis = new Checkbox("Disabled", g, false));
-
- targetName = getParameter("TARGETAPP");
- }
-
- public boolean handleEvent(Event e) {
- if (button == null) {
- Applet t=null;
- if (targetName != null) t = getApplet(targetName);
- if (t != null && t instanceof ImageButtonApplet) {
- button = ((ImageButtonApplet) t).getImageButton();
- }
- }
-
- if (button == null) return super.handleEvent(e);
-
- if (e.id == Event.ACTION_EVENT) {
- if (e.target == en) button.enable();
- else if (e.target == dis) button.disable();
- }
- return super.handleEvent(e);
- }
- }
-
-