home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / awt / Button.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  4.2 KB  |  179 lines

  1. package java.awt;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.awt.peer.ButtonPeer;
  6. import java.io.IOException;
  7. import java.io.ObjectInputStream;
  8. import java.io.ObjectOutputStream;
  9. import java.util.EventListener;
  10. import javax.accessibility.Accessible;
  11. import javax.accessibility.AccessibleContext;
  12.  
  13. public class Button extends Component implements Accessible {
  14.    String label;
  15.    String actionCommand;
  16.    transient ActionListener actionListener;
  17.    private static final String base = "button";
  18.    private static int nameCounter = 0;
  19.    private static final long serialVersionUID = -8774683716313001058L;
  20.    private int buttonSerializedDataVersion;
  21.    // $FF: synthetic field
  22.    static Class class$java$awt$event$ActionListener;
  23.  
  24.    private static native void initIDs();
  25.  
  26.    public Button() {
  27.       this("");
  28.    }
  29.  
  30.    public Button(String var1) {
  31.       this.buttonSerializedDataVersion = 1;
  32.       this.label = var1;
  33.    }
  34.  
  35.    String constructComponentName() {
  36.       Class var1 = this.getClass();
  37.       synchronized(var1) {
  38.          String var2 = "button" + nameCounter++;
  39.          return var2;
  40.       }
  41.    }
  42.  
  43.    public void addNotify() {
  44.       Object var1 = ((Component)this).getTreeLock();
  45.       synchronized(var1) {
  46.          if (super.peer == null) {
  47.             super.peer = ((Component)this).getToolkit().createButton(this);
  48.          }
  49.  
  50.          super.addNotify();
  51.       }
  52.    }
  53.  
  54.    public String getLabel() {
  55.       return this.label;
  56.    }
  57.  
  58.    public void setLabel(String var1) {
  59.       boolean var2 = false;
  60.       synchronized(this) {
  61.          if (var1 != this.label && (this.label == null || !this.label.equals(var1))) {
  62.             this.label = var1;
  63.             ButtonPeer var4 = (ButtonPeer)super.peer;
  64.             if (var4 != null) {
  65.                var4.setLabel(var1);
  66.             }
  67.  
  68.             var2 = true;
  69.          }
  70.       }
  71.  
  72.       if (var2 && super.valid) {
  73.          ((Component)this).invalidate();
  74.       }
  75.  
  76.    }
  77.  
  78.    public void setActionCommand(String var1) {
  79.       this.actionCommand = var1;
  80.    }
  81.  
  82.    public String getActionCommand() {
  83.       return this.actionCommand == null ? this.label : this.actionCommand;
  84.    }
  85.  
  86.    public synchronized void addActionListener(ActionListener var1) {
  87.       if (var1 != null) {
  88.          this.actionListener = AWTEventMulticaster.add(this.actionListener, var1);
  89.          super.newEventsOnly = true;
  90.       }
  91.    }
  92.  
  93.    public synchronized void removeActionListener(ActionListener var1) {
  94.       if (var1 != null) {
  95.          this.actionListener = AWTEventMulticaster.remove(this.actionListener, var1);
  96.       }
  97.    }
  98.  
  99.    public EventListener[] getListeners(Class var1) {
  100.       Object var2 = null;
  101.       if (var1 == (class$java$awt$event$ActionListener == null ? (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")) : class$java$awt$event$ActionListener)) {
  102.          ActionListener var3 = this.actionListener;
  103.          return AWTEventMulticaster.getListeners(var3, var1);
  104.       } else {
  105.          return super.getListeners(var1);
  106.       }
  107.    }
  108.  
  109.    boolean eventEnabled(AWTEvent var1) {
  110.       if (var1.id == 1001) {
  111.          return (super.eventMask & 128L) != 0L || this.actionListener != null;
  112.       } else {
  113.          return super.eventEnabled(var1);
  114.       }
  115.    }
  116.  
  117.    protected void processEvent(AWTEvent var1) {
  118.       if (var1 instanceof ActionEvent) {
  119.          this.processActionEvent((ActionEvent)var1);
  120.       } else {
  121.          super.processEvent(var1);
  122.       }
  123.    }
  124.  
  125.    protected void processActionEvent(ActionEvent var1) {
  126.       if (this.actionListener != null) {
  127.          this.actionListener.actionPerformed(var1);
  128.       }
  129.  
  130.    }
  131.  
  132.    protected String paramString() {
  133.       return super.paramString() + ",label=" + this.label;
  134.    }
  135.  
  136.    private void writeObject(ObjectOutputStream var1) throws IOException {
  137.       var1.defaultWriteObject();
  138.       AWTEventMulticaster.save(var1, "actionL", this.actionListener);
  139.       var1.writeObject((Object)null);
  140.    }
  141.  
  142.    private void readObject(ObjectInputStream var1) throws ClassNotFoundException, IOException {
  143.       var1.defaultReadObject();
  144.  
  145.       Object var2;
  146.       while(null != (var2 = var1.readObject())) {
  147.          String var3 = ((String)var2).intern();
  148.          if ("actionL" == var3) {
  149.             this.addActionListener((ActionListener)var1.readObject());
  150.          } else {
  151.             var1.readObject();
  152.          }
  153.       }
  154.  
  155.    }
  156.  
  157.    public AccessibleContext getAccessibleContext() {
  158.       if (super.accessibleContext == null) {
  159.          super.accessibleContext = new AccessibleAWTButton(this);
  160.       }
  161.  
  162.       return super.accessibleContext;
  163.    }
  164.  
  165.    // $FF: synthetic method
  166.    static Class class$(String var0) {
  167.       try {
  168.          return Class.forName(var0);
  169.       } catch (ClassNotFoundException var2) {
  170.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  171.       }
  172.    }
  173.  
  174.    static {
  175.       Toolkit.loadLibraries();
  176.       initIDs();
  177.    }
  178. }
  179.