home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.peer.ButtonPeer;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
-
- public class Button extends Component {
- String label;
- String actionCommand;
- transient ActionListener actionListener;
- private static final String base = "button";
- private static int nameCounter;
- private static final long serialVersionUID = -8774683716313001058L;
- private int buttonSerializedDataVersion;
-
- public Button() {
- this("");
- }
-
- public Button(String var1) {
- this.buttonSerializedDataVersion = 1;
- super.name = "button" + nameCounter++;
- this.label = var1;
- }
-
- public void addNotify() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1){}
-
- try {
- if (super.peer == null) {
- super.peer = ((Component)this).getToolkit().createButton(this);
- }
-
- super.addNotify();
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
-
- public String getLabel() {
- return this.label;
- }
-
- public synchronized void setLabel(String var1) {
- this.label = var1;
- ButtonPeer var2 = (ButtonPeer)super.peer;
- if (var2 != null) {
- var2.setLabel(var1);
- }
-
- }
-
- public void setActionCommand(String var1) {
- this.actionCommand = var1;
- }
-
- public String getActionCommand() {
- return this.actionCommand == null ? this.label : this.actionCommand;
- }
-
- public synchronized void addActionListener(ActionListener var1) {
- this.actionListener = AWTEventMulticaster.add(this.actionListener, var1);
- super.newEventsOnly = true;
- }
-
- public synchronized void removeActionListener(ActionListener var1) {
- this.actionListener = AWTEventMulticaster.remove(this.actionListener, var1);
- }
-
- boolean eventEnabled(AWTEvent var1) {
- if (var1.id == 1001) {
- return (super.eventMask & 128L) != 0L || this.actionListener != null;
- } else {
- return super.eventEnabled(var1);
- }
- }
-
- protected void processEvent(AWTEvent var1) {
- if (var1 instanceof ActionEvent) {
- this.processActionEvent((ActionEvent)var1);
- } else {
- super.processEvent(var1);
- }
- }
-
- protected void processActionEvent(ActionEvent var1) {
- if (this.actionListener != null) {
- this.actionListener.actionPerformed(var1);
- }
-
- }
-
- protected String paramString() {
- return super.paramString() + ",label=" + this.label;
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- var1.defaultWriteObject();
- AWTEventMulticaster.save(var1, "actionL", this.actionListener);
- var1.writeObject((Object)null);
- }
-
- private void readObject(ObjectInputStream var1) throws ClassNotFoundException, IOException {
- var1.defaultReadObject();
-
- Object var2;
- while((var2 = var1.readObject()) != null) {
- String var3 = ((String)var2).intern();
- if (var3 == "actionL") {
- this.addActionListener((ActionListener)var1.readObject());
- } else {
- var1.readObject();
- }
- }
-
- }
- }
-