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;
- import java.util.EventListener;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
-
- public class Button extends Component implements Accessible {
- String label;
- String actionCommand;
- transient ActionListener actionListener;
- private static final String base = "button";
- private static int nameCounter = 0;
- private static final long serialVersionUID = -8774683716313001058L;
- private int buttonSerializedDataVersion;
-
- private static native void initIDs();
-
- public Button() throws HeadlessException {
- this("");
- }
-
- public Button(String var1) throws HeadlessException {
- this.buttonSerializedDataVersion = 1;
- GraphicsEnvironment.checkHeadless();
- this.label = var1;
- }
-
- String constructComponentName() {
- synchronized(this.getClass()) {
- return "button" + nameCounter++;
- }
- }
-
- public void addNotify() {
- synchronized(this.getTreeLock()) {
- if (this.peer == null) {
- this.peer = this.getToolkit().createButton(this);
- }
-
- super.addNotify();
- }
- }
-
- public String getLabel() {
- return this.label;
- }
-
- public void setLabel(String var1) {
- boolean var2 = false;
- synchronized(this) {
- if (var1 != this.label && (this.label == null || !this.label.equals(var1))) {
- this.label = var1;
- ButtonPeer var4 = (ButtonPeer)this.peer;
- if (var4 != null) {
- var4.setLabel(var1);
- }
-
- var2 = true;
- }
- }
-
- if (var2 && this.valid) {
- this.invalidate();
- }
-
- }
-
- 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) {
- if (var1 != null) {
- this.actionListener = AWTEventMulticaster.add(this.actionListener, var1);
- this.newEventsOnly = true;
- }
- }
-
- public synchronized void removeActionListener(ActionListener var1) {
- if (var1 != null) {
- this.actionListener = AWTEventMulticaster.remove(this.actionListener, var1);
- }
- }
-
- public synchronized ActionListener[] getActionListeners() {
- return (ActionListener[])this.getListeners(ActionListener.class);
- }
-
- public <T extends EventListener> T[] getListeners(Class<T> var1) {
- Object var2 = null;
- if (var1 == ActionListener.class) {
- ActionListener var3 = this.actionListener;
- return (T[])AWTEventMulticaster.getListeners(var3, var1);
- } else {
- return (T[])super.getListeners(var1);
- }
- }
-
- boolean eventEnabled(AWTEvent var1) {
- if (var1.id == 1001) {
- return (this.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) {
- ActionListener var2 = this.actionListener;
- if (var2 != null) {
- var2.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, HeadlessException {
- GraphicsEnvironment.checkHeadless();
- var1.defaultReadObject();
-
- Object var2;
- while(null != (var2 = var1.readObject())) {
- String var3 = ((String)var2).intern();
- if ("actionL" == var3) {
- this.addActionListener((ActionListener)var1.readObject());
- } else {
- var1.readObject();
- }
- }
-
- }
-
- public AccessibleContext getAccessibleContext() {
- if (this.accessibleContext == null) {
- this.accessibleContext = new AccessibleAWTButton(this);
- }
-
- return this.accessibleContext;
- }
-
- static {
- Toolkit.loadLibraries();
- if (!GraphicsEnvironment.isHeadless()) {
- initIDs();
- }
-
- }
- }
-