home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.ItemSelectable;
- import java.awt.LayoutManager;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ItemEvent;
- import java.awt.event.ItemListener;
- import java.beans.PropertyChangeListener;
- import javax.accessibility.AccessibleState;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
- import javax.swing.plaf.ButtonUI;
- import javax.swing.plaf.UIResource;
-
- public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
- public static final String MODEL_CHANGED_PROPERTY = "model";
- public static final String TEXT_CHANGED_PROPERTY = "text";
- public static final String MNEMONIC_CHANGED_PROPERTY = "mnemonic";
- public static final String MARGIN_CHANGED_PROPERTY = "margin";
- public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY = "verticalAlignment";
- public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY = "horizontalAlignment";
- public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY = "verticalTextPosition";
- public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY = "horizontalTextPosition";
- public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
- public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
- public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY = "rolloverEnabled";
- public static final String CONTENT_AREA_FILLED_CHANGED_PROPERTY = "contentAreaFilled";
- public static final String ICON_CHANGED_PROPERTY = "icon";
- public static final String PRESSED_ICON_CHANGED_PROPERTY = "pressedIcon";
- public static final String SELECTED_ICON_CHANGED_PROPERTY = "selectedIcon";
- public static final String ROLLOVER_ICON_CHANGED_PROPERTY = "rolloverIcon";
- public static final String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY = "rolloverSelectedIcon";
- public static final String DISABLED_ICON_CHANGED_PROPERTY = "disabledIcon";
- public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY = "disabledSelectedIcon";
- protected ButtonModel model = null;
- private String text = "";
- private Insets margin = null;
- private Insets defaultMargin = null;
- private Icon defaultIcon = null;
- private Icon pressedIcon = null;
- private Icon disabledIcon = null;
- private Icon selectedIcon = null;
- private Icon disabledSelectedIcon = null;
- private Icon rolloverIcon = null;
- private Icon rolloverSelectedIcon = null;
- private boolean paintBorder = true;
- private boolean paintFocus = true;
- private boolean rolloverEnabled = false;
- private boolean contentAreaFilled = true;
- private int verticalAlignment = 0;
- private int horizontalAlignment = 0;
- private int verticalTextPosition = 0;
- private int horizontalTextPosition = 11;
- private int iconTextGap = 4;
- private int mnemonic;
- private int mnemonicIndex = -1;
- private long multiClickThreshhold = 0L;
- private boolean borderPaintedSet = false;
- private boolean rolloverEnabledSet = false;
- private boolean iconTextGapSet = false;
- private boolean contentAreaFilledSet = false;
- private boolean setLayout = false;
- boolean defaultCapable = true;
- private Handler handler;
- protected ChangeListener changeListener = null;
- protected ActionListener actionListener = null;
- protected ItemListener itemListener = null;
- protected transient ChangeEvent changeEvent;
- private boolean hideActionText = false;
- private Action action;
- private PropertyChangeListener actionPropertyChangeListener;
-
- public void setHideActionText(boolean var1) {
- if (var1 != this.hideActionText) {
- this.hideActionText = var1;
- if (this.getAction() != null) {
- this.setTextFromAction(this.getAction(), false);
- }
-
- this.firePropertyChange("hideActionText", !var1, var1);
- }
-
- }
-
- public boolean getHideActionText() {
- return this.hideActionText;
- }
-
- public String getText() {
- return this.text;
- }
-
- public void setText(String var1) {
- String var2 = this.text;
- this.text = var1;
- this.firePropertyChange("text", var2, var1);
- this.updateDisplayedMnemonicIndex(var1, this.getMnemonic());
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 == null || var2 == null || !var1.equals(var2)) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public boolean isSelected() {
- return this.model.isSelected();
- }
-
- public void setSelected(boolean var1) {
- boolean var2 = this.isSelected();
- this.model.setSelected(var1);
- }
-
- public void doClick() {
- this.doClick(68);
- }
-
- public void doClick(int var1) {
- Dimension var2 = this.getSize();
- this.model.setArmed(true);
- this.model.setPressed(true);
- this.paintImmediately(new Rectangle(0, 0, var2.width, var2.height));
-
- try {
- Thread.currentThread();
- Thread.sleep((long)var1);
- } catch (InterruptedException var4) {
- }
-
- this.model.setPressed(false);
- this.model.setArmed(false);
- }
-
- public void setMargin(Insets var1) {
- if (var1 instanceof UIResource) {
- this.defaultMargin = var1;
- } else if (this.margin instanceof UIResource) {
- this.defaultMargin = this.margin;
- }
-
- if (var1 == null && this.defaultMargin != null) {
- var1 = this.defaultMargin;
- }
-
- Insets var2 = this.margin;
- this.margin = var1;
- this.firePropertyChange("margin", var2, var1);
- if (var2 == null || !var2.equals(var1)) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public Insets getMargin() {
- return this.margin == null ? null : (Insets)this.margin.clone();
- }
-
- public Icon getIcon() {
- return this.defaultIcon;
- }
-
- public void setIcon(Icon var1) {
- Icon var2 = this.defaultIcon;
- this.defaultIcon = var1;
- if (var1 != var2 && this.disabledIcon instanceof UIResource) {
- this.disabledIcon = null;
- }
-
- this.firePropertyChange("icon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 != var2) {
- if (var1 == null || var2 == null || var1.getIconWidth() != var2.getIconWidth() || var1.getIconHeight() != var2.getIconHeight()) {
- this.revalidate();
- }
-
- this.repaint();
- }
-
- }
-
- public Icon getPressedIcon() {
- return this.pressedIcon;
- }
-
- public void setPressedIcon(Icon var1) {
- Icon var2 = this.pressedIcon;
- this.pressedIcon = var1;
- this.firePropertyChange("pressedIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 != var2 && this.getModel().isPressed()) {
- this.repaint();
- }
-
- }
-
- public Icon getSelectedIcon() {
- return this.selectedIcon;
- }
-
- public void setSelectedIcon(Icon var1) {
- Icon var2 = this.selectedIcon;
- this.selectedIcon = var1;
- if (var1 != var2 && this.disabledSelectedIcon instanceof UIResource) {
- this.disabledSelectedIcon = null;
- }
-
- this.firePropertyChange("selectedIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 != var2 && this.isSelected()) {
- this.repaint();
- }
-
- }
-
- public Icon getRolloverIcon() {
- return this.rolloverIcon;
- }
-
- public void setRolloverIcon(Icon var1) {
- Icon var2 = this.rolloverIcon;
- this.rolloverIcon = var1;
- this.firePropertyChange("rolloverIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- this.setRolloverEnabled(true);
- if (var1 != var2) {
- this.repaint();
- }
-
- }
-
- public Icon getRolloverSelectedIcon() {
- return this.rolloverSelectedIcon;
- }
-
- public void setRolloverSelectedIcon(Icon var1) {
- Icon var2 = this.rolloverSelectedIcon;
- this.rolloverSelectedIcon = var1;
- this.firePropertyChange("rolloverSelectedIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- this.setRolloverEnabled(true);
- if (var1 != var2 && this.isSelected()) {
- this.repaint();
- }
-
- }
-
- public Icon getDisabledIcon() {
- if (this.disabledIcon == null) {
- this.disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, this.getIcon());
- if (this.disabledIcon != null) {
- this.firePropertyChange("disabledIcon", (Object)null, this.disabledIcon);
- }
- }
-
- return this.disabledIcon;
- }
-
- public void setDisabledIcon(Icon var1) {
- Icon var2 = this.disabledIcon;
- this.disabledIcon = var1;
- this.firePropertyChange("disabledIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 != var2 && !this.isEnabled()) {
- this.repaint();
- }
-
- }
-
- public Icon getDisabledSelectedIcon() {
- if (this.disabledSelectedIcon == null) {
- if (this.selectedIcon == null) {
- return this.getDisabledIcon();
- }
-
- this.disabledSelectedIcon = UIManager.getLookAndFeel().getDisabledSelectedIcon(this, this.getSelectedIcon());
- }
-
- return this.disabledSelectedIcon;
- }
-
- public void setDisabledSelectedIcon(Icon var1) {
- Icon var2 = this.disabledSelectedIcon;
- this.disabledSelectedIcon = var1;
- this.firePropertyChange("disabledSelectedIcon", var2, var1);
- if (this.accessibleContext != null) {
- this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
- }
-
- if (var1 != var2) {
- if (var1 == null || var2 == null || var1.getIconWidth() != var2.getIconWidth() || var1.getIconHeight() != var2.getIconHeight()) {
- this.revalidate();
- }
-
- if (!this.isEnabled() && this.isSelected()) {
- this.repaint();
- }
- }
-
- }
-
- public int getVerticalAlignment() {
- return this.verticalAlignment;
- }
-
- public void setVerticalAlignment(int var1) {
- if (var1 != this.verticalAlignment) {
- int var2 = this.verticalAlignment;
- this.verticalAlignment = this.checkVerticalKey(var1, "verticalAlignment");
- this.firePropertyChange("verticalAlignment", var2, this.verticalAlignment);
- this.repaint();
- }
- }
-
- public int getHorizontalAlignment() {
- return this.horizontalAlignment;
- }
-
- public void setHorizontalAlignment(int var1) {
- if (var1 != this.horizontalAlignment) {
- int var2 = this.horizontalAlignment;
- this.horizontalAlignment = this.checkHorizontalKey(var1, "horizontalAlignment");
- this.firePropertyChange("horizontalAlignment", var2, this.horizontalAlignment);
- this.repaint();
- }
- }
-
- public int getVerticalTextPosition() {
- return this.verticalTextPosition;
- }
-
- public void setVerticalTextPosition(int var1) {
- if (var1 != this.verticalTextPosition) {
- int var2 = this.verticalTextPosition;
- this.verticalTextPosition = this.checkVerticalKey(var1, "verticalTextPosition");
- this.firePropertyChange("verticalTextPosition", var2, this.verticalTextPosition);
- this.revalidate();
- this.repaint();
- }
- }
-
- public int getHorizontalTextPosition() {
- return this.horizontalTextPosition;
- }
-
- public void setHorizontalTextPosition(int var1) {
- if (var1 != this.horizontalTextPosition) {
- int var2 = this.horizontalTextPosition;
- this.horizontalTextPosition = this.checkHorizontalKey(var1, "horizontalTextPosition");
- this.firePropertyChange("horizontalTextPosition", var2, this.horizontalTextPosition);
- this.revalidate();
- this.repaint();
- }
- }
-
- public int getIconTextGap() {
- return this.iconTextGap;
- }
-
- public void setIconTextGap(int var1) {
- int var2 = this.iconTextGap;
- this.iconTextGap = var1;
- this.iconTextGapSet = true;
- this.firePropertyChange("iconTextGap", var2, var1);
- if (var1 != var2) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- protected int checkHorizontalKey(int var1, String var2) {
- if (var1 != 2 && var1 != 0 && var1 != 4 && var1 != 10 && var1 != 11) {
- throw new IllegalArgumentException(var2);
- } else {
- return var1;
- }
- }
-
- protected int checkVerticalKey(int var1, String var2) {
- if (var1 != 1 && var1 != 0 && var1 != 3) {
- throw new IllegalArgumentException(var2);
- } else {
- return var1;
- }
- }
-
- public void removeNotify() {
- super.removeNotify();
- if (this.isRolloverEnabled()) {
- this.getModel().setRollover(false);
- }
-
- }
-
- public void setActionCommand(String var1) {
- this.getModel().setActionCommand(var1);
- }
-
- public String getActionCommand() {
- String var1 = this.getModel().getActionCommand();
- if (var1 == null) {
- var1 = this.getText();
- }
-
- return var1;
- }
-
- public void setAction(Action var1) {
- Action var2 = this.getAction();
- if (this.action == null || !this.action.equals(var1)) {
- this.action = var1;
- if (var2 != null) {
- this.removeActionListener(var2);
- var2.removePropertyChangeListener(this.actionPropertyChangeListener);
- this.actionPropertyChangeListener = null;
- }
-
- this.configurePropertiesFromAction(this.action);
- if (this.action != null) {
- if (!this.isListener(ActionListener.class, this.action)) {
- this.addActionListener(this.action);
- }
-
- this.actionPropertyChangeListener = this.createActionPropertyChangeListener(this.action);
- this.action.addPropertyChangeListener(this.actionPropertyChangeListener);
- }
-
- this.firePropertyChange("action", var2, this.action);
- }
-
- }
-
- private boolean isListener(Class var1, ActionListener var2) {
- boolean var3 = false;
- Object[] var4 = this.listenerList.getListenerList();
-
- for(int var5 = var4.length - 2; var5 >= 0; var5 -= 2) {
- if (var4[var5] == var1 && var4[var5 + 1] == var2) {
- var3 = true;
- }
- }
-
- return var3;
- }
-
- public Action getAction() {
- return this.action;
- }
-
- protected void configurePropertiesFromAction(Action var1) {
- this.setMnemonicFromAction(var1);
- this.setTextFromAction(var1, false);
- AbstractAction.setToolTipTextFromAction(this, var1);
- this.setIconFromAction(var1);
- this.setActionCommandFromAction(var1);
- AbstractAction.setEnabledFromAction(this, var1);
- if (AbstractAction.hasSelectedKey(var1) && this.shouldUpdateSelectedStateFromAction()) {
- this.setSelectedFromAction(var1);
- }
-
- this.setDisplayedMnemonicIndexFromAction(var1, false);
- }
-
- void clientPropertyChanged(Object var1, Object var2, Object var3) {
- if (var1 == "hideActionText") {
- boolean var4 = var3 instanceof Boolean ? (Boolean)var3 : false;
- if (this.getHideActionText() != var4) {
- this.setHideActionText(var4);
- }
- }
-
- }
-
- boolean shouldUpdateSelectedStateFromAction() {
- return false;
- }
-
- protected void actionPropertyChanged(Action var1, String var2) {
- if (var2 == "Name") {
- this.setTextFromAction(var1, true);
- } else if (var2 == "enabled") {
- AbstractAction.setEnabledFromAction(this, var1);
- } else if (var2 == "ShortDescription") {
- AbstractAction.setToolTipTextFromAction(this, var1);
- } else if (var2 == "SmallIcon") {
- this.smallIconChanged(var1);
- } else if (var2 == "MnemonicKey") {
- this.setMnemonicFromAction(var1);
- } else if (var2 == "ActionCommandKey") {
- this.setActionCommandFromAction(var1);
- } else if (var2 == "SwingSelectedKey" && AbstractAction.hasSelectedKey(var1) && this.shouldUpdateSelectedStateFromAction()) {
- this.setSelectedFromAction(var1);
- } else if (var2 == "SwingDisplayedMnemonicIndexKey") {
- this.setDisplayedMnemonicIndexFromAction(var1, true);
- } else if (var2 == "SwingLargeIconKey") {
- this.largeIconChanged(var1);
- }
-
- }
-
- private void setDisplayedMnemonicIndexFromAction(Action var1, boolean var2) {
- Integer var3 = var1 == null ? null : (Integer)var1.getValue("SwingDisplayedMnemonicIndexKey");
- if (var2 || var3 != null) {
- int var4;
- if (var3 == null) {
- var4 = -1;
- } else {
- var4 = var3;
- String var5 = this.getText();
- if (var5 == null || var4 >= var5.length()) {
- var4 = -1;
- }
- }
-
- this.setDisplayedMnemonicIndex(var4);
- }
-
- }
-
- private void setMnemonicFromAction(Action var1) {
- Integer var2 = var1 == null ? null : (Integer)var1.getValue("MnemonicKey");
- this.setMnemonic(var2 == null ? 0 : var2);
- }
-
- private void setTextFromAction(Action var1, boolean var2) {
- boolean var3 = this.getHideActionText();
- if (!var2) {
- this.setText(var1 != null && !var3 ? (String)var1.getValue("Name") : null);
- } else if (!var3) {
- this.setText((String)var1.getValue("Name"));
- }
-
- }
-
- void setIconFromAction(Action var1) {
- Icon var2 = null;
- if (var1 != null) {
- var2 = (Icon)var1.getValue("SwingLargeIconKey");
- if (var2 == null) {
- var2 = (Icon)var1.getValue("SmallIcon");
- }
- }
-
- this.setIcon(var2);
- }
-
- void smallIconChanged(Action var1) {
- if (var1.getValue("SwingLargeIconKey") == null) {
- this.setIconFromAction(var1);
- }
-
- }
-
- void largeIconChanged(Action var1) {
- this.setIconFromAction(var1);
- }
-
- private void setActionCommandFromAction(Action var1) {
- this.setActionCommand(var1 != null ? (String)var1.getValue("ActionCommandKey") : null);
- }
-
- private void setSelectedFromAction(Action var1) {
- boolean var2 = false;
- if (var1 != null) {
- var2 = AbstractAction.isSelected(var1);
- }
-
- if (var2 != this.isSelected()) {
- this.setSelected(var2);
- if (!var2 && this.isSelected() && this.getModel() instanceof DefaultButtonModel) {
- ButtonGroup var3 = ((DefaultButtonModel)this.getModel()).getGroup();
- if (var3 != null) {
- var3.clearSelection();
- }
- }
- }
-
- }
-
- protected PropertyChangeListener createActionPropertyChangeListener(Action var1) {
- return this.createActionPropertyChangeListener0(var1);
- }
-
- PropertyChangeListener createActionPropertyChangeListener0(Action var1) {
- return new ButtonActionPropertyChangeListener(this, var1);
- }
-
- public boolean isBorderPainted() {
- return this.paintBorder;
- }
-
- public void setBorderPainted(boolean var1) {
- boolean var2 = this.paintBorder;
- this.paintBorder = var1;
- this.borderPaintedSet = true;
- this.firePropertyChange("borderPainted", var2, this.paintBorder);
- if (var1 != var2) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- protected void paintBorder(Graphics var1) {
- if (this.isBorderPainted()) {
- super.paintBorder(var1);
- }
-
- }
-
- public boolean isFocusPainted() {
- return this.paintFocus;
- }
-
- public void setFocusPainted(boolean var1) {
- boolean var2 = this.paintFocus;
- this.paintFocus = var1;
- this.firePropertyChange("focusPainted", var2, this.paintFocus);
- if (var1 != var2 && this.isFocusOwner()) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public boolean isContentAreaFilled() {
- return this.contentAreaFilled;
- }
-
- public void setContentAreaFilled(boolean var1) {
- boolean var2 = this.contentAreaFilled;
- this.contentAreaFilled = var1;
- this.contentAreaFilledSet = true;
- this.firePropertyChange("contentAreaFilled", var2, this.contentAreaFilled);
- if (var1 != var2) {
- this.repaint();
- }
-
- }
-
- public boolean isRolloverEnabled() {
- return this.rolloverEnabled;
- }
-
- public void setRolloverEnabled(boolean var1) {
- boolean var2 = this.rolloverEnabled;
- this.rolloverEnabled = var1;
- this.rolloverEnabledSet = true;
- this.firePropertyChange("rolloverEnabled", var2, this.rolloverEnabled);
- if (var1 != var2) {
- this.repaint();
- }
-
- }
-
- public int getMnemonic() {
- return this.mnemonic;
- }
-
- public void setMnemonic(int var1) {
- int var2 = this.getMnemonic();
- this.model.setMnemonic(var1);
- this.updateMnemonicProperties();
- }
-
- public void setMnemonic(char var1) {
- int var2 = var1;
- if (var1 >= 'a' && var1 <= 'z') {
- var2 = var1 - 32;
- }
-
- this.setMnemonic(var2);
- }
-
- public void setDisplayedMnemonicIndex(int var1) throws IllegalArgumentException {
- int var2 = this.mnemonicIndex;
- if (var1 == -1) {
- this.mnemonicIndex = -1;
- } else {
- String var3 = this.getText();
- int var4 = var3 == null ? 0 : var3.length();
- if (var1 < -1 || var1 >= var4) {
- throw new IllegalArgumentException("index == " + var1);
- }
- }
-
- this.mnemonicIndex = var1;
- this.firePropertyChange("displayedMnemonicIndex", var2, var1);
- if (var1 != var2) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public int getDisplayedMnemonicIndex() {
- return this.mnemonicIndex;
- }
-
- private void updateDisplayedMnemonicIndex(String var1, int var2) {
- this.setDisplayedMnemonicIndex(SwingUtilities.findDisplayedMnemonicIndex(var1, var2));
- }
-
- private void updateMnemonicProperties() {
- int var1 = this.model.getMnemonic();
- if (this.mnemonic != var1) {
- int var2 = this.mnemonic;
- this.mnemonic = var1;
- this.firePropertyChange("mnemonic", var2, this.mnemonic);
- this.updateDisplayedMnemonicIndex(this.getText(), this.mnemonic);
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public void setMultiClickThreshhold(long var1) {
- if (var1 < 0L) {
- throw new IllegalArgumentException("threshhold must be >= 0");
- } else {
- this.multiClickThreshhold = var1;
- }
- }
-
- public long getMultiClickThreshhold() {
- return this.multiClickThreshhold;
- }
-
- public ButtonModel getModel() {
- return this.model;
- }
-
- public void setModel(ButtonModel var1) {
- ButtonModel var2 = this.getModel();
- if (var2 != null) {
- var2.removeChangeListener(this.changeListener);
- var2.removeActionListener(this.actionListener);
- var2.removeItemListener(this.itemListener);
- this.changeListener = null;
- this.actionListener = null;
- this.itemListener = null;
- }
-
- this.model = var1;
- if (var1 != null) {
- this.changeListener = this.createChangeListener();
- this.actionListener = this.createActionListener();
- this.itemListener = this.createItemListener();
- var1.addChangeListener(this.changeListener);
- var1.addActionListener(this.actionListener);
- var1.addItemListener(this.itemListener);
- this.updateMnemonicProperties();
- super.setEnabled(var1.isEnabled());
- } else {
- this.mnemonic = 0;
- }
-
- this.updateDisplayedMnemonicIndex(this.getText(), this.mnemonic);
- this.firePropertyChange("model", var2, var1);
- if (var1 != var2) {
- this.revalidate();
- this.repaint();
- }
-
- }
-
- public ButtonUI getUI() {
- return (ButtonUI)this.ui;
- }
-
- public void setUI(ButtonUI var1) {
- super.setUI(var1);
- if (this.disabledIcon instanceof UIResource) {
- this.setDisabledIcon((Icon)null);
- }
-
- if (this.disabledSelectedIcon instanceof UIResource) {
- this.setDisabledSelectedIcon((Icon)null);
- }
-
- }
-
- public void updateUI() {
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- if (!this.setLayout) {
- this.setLayout(new OverlayLayout(this));
- }
-
- super.addImpl(var1, var2, var3);
- }
-
- public void setLayout(LayoutManager var1) {
- this.setLayout = true;
- super.setLayout(var1);
- }
-
- public void addChangeListener(ChangeListener var1) {
- this.listenerList.add(ChangeListener.class, var1);
- }
-
- public void removeChangeListener(ChangeListener var1) {
- this.listenerList.remove(ChangeListener.class, var1);
- }
-
- public ChangeListener[] getChangeListeners() {
- return (ChangeListener[])this.listenerList.getListeners(ChangeListener.class);
- }
-
- protected void fireStateChanged() {
- Object[] var1 = this.listenerList.getListenerList();
-
- for(int var2 = var1.length - 2; var2 >= 0; var2 -= 2) {
- if (var1[var2] == ChangeListener.class) {
- if (this.changeEvent == null) {
- this.changeEvent = new ChangeEvent(this);
- }
-
- ((ChangeListener)var1[var2 + 1]).stateChanged(this.changeEvent);
- }
- }
-
- }
-
- public void addActionListener(ActionListener var1) {
- this.listenerList.add(ActionListener.class, var1);
- }
-
- public void removeActionListener(ActionListener var1) {
- if (var1 != null && this.getAction() == var1) {
- this.setAction((Action)null);
- } else {
- this.listenerList.remove(ActionListener.class, var1);
- }
-
- }
-
- public ActionListener[] getActionListeners() {
- return (ActionListener[])this.listenerList.getListeners(ActionListener.class);
- }
-
- protected ChangeListener createChangeListener() {
- return this.getHandler();
- }
-
- protected void fireActionPerformed(ActionEvent var1) {
- Object[] var2 = this.listenerList.getListenerList();
- ActionEvent var3 = null;
-
- for(int var4 = var2.length - 2; var4 >= 0; var4 -= 2) {
- if (var2[var4] == ActionListener.class) {
- if (var3 == null) {
- String var5 = var1.getActionCommand();
- if (var5 == null) {
- var5 = this.getActionCommand();
- }
-
- var3 = new ActionEvent(this, 1001, var5, var1.getWhen(), var1.getModifiers());
- }
-
- ((ActionListener)var2[var4 + 1]).actionPerformed(var3);
- }
- }
-
- }
-
- protected void fireItemStateChanged(ItemEvent var1) {
- Object[] var2 = this.listenerList.getListenerList();
- ItemEvent var3 = null;
-
- for(int var4 = var2.length - 2; var4 >= 0; var4 -= 2) {
- if (var2[var4] == ItemListener.class) {
- if (var3 == null) {
- var3 = new ItemEvent(this, 701, this, var1.getStateChange());
- }
-
- ((ItemListener)var2[var4 + 1]).itemStateChanged(var3);
- }
- }
-
- if (this.accessibleContext != null) {
- if (var1.getStateChange() == 1) {
- this.accessibleContext.firePropertyChange("AccessibleState", (Object)null, AccessibleState.SELECTED);
- this.accessibleContext.firePropertyChange("AccessibleValue", new Integer(0), new Integer(1));
- } else {
- this.accessibleContext.firePropertyChange("AccessibleState", AccessibleState.SELECTED, (Object)null);
- this.accessibleContext.firePropertyChange("AccessibleValue", new Integer(1), new Integer(0));
- }
- }
-
- }
-
- protected ActionListener createActionListener() {
- return this.getHandler();
- }
-
- protected ItemListener createItemListener() {
- return this.getHandler();
- }
-
- public void setEnabled(boolean var1) {
- if (!var1 && this.model.isRollover()) {
- this.model.setRollover(false);
- }
-
- super.setEnabled(var1);
- this.model.setEnabled(var1);
- }
-
- /** @deprecated */
- @Deprecated
- public String getLabel() {
- return this.getText();
- }
-
- /** @deprecated */
- @Deprecated
- public void setLabel(String var1) {
- this.setText(var1);
- }
-
- public void addItemListener(ItemListener var1) {
- this.listenerList.add(ItemListener.class, var1);
- }
-
- public void removeItemListener(ItemListener var1) {
- this.listenerList.remove(ItemListener.class, var1);
- }
-
- public ItemListener[] getItemListeners() {
- return (ItemListener[])this.listenerList.getListeners(ItemListener.class);
- }
-
- public Object[] getSelectedObjects() {
- if (!this.isSelected()) {
- return null;
- } else {
- Object[] var1 = new Object[]{this.getText()};
- return var1;
- }
- }
-
- protected void init(String var1, Icon var2) {
- if (var1 != null) {
- this.setText(var1);
- }
-
- if (var2 != null) {
- this.setIcon(var2);
- }
-
- this.updateUI();
- this.setAlignmentX(0.0F);
- this.setAlignmentY(0.5F);
- }
-
- public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- Icon var7 = this.getIcon();
- if (var7 == null) {
- return false;
- } else {
- if (!this.model.isEnabled()) {
- if (this.model.isSelected()) {
- var7 = this.getDisabledSelectedIcon();
- } else {
- var7 = this.getDisabledIcon();
- }
- } else if (this.model.isPressed() && this.model.isArmed()) {
- var7 = this.getPressedIcon();
- } else if (this.isRolloverEnabled() && this.model.isRollover()) {
- if (this.model.isSelected()) {
- var7 = this.getRolloverSelectedIcon();
- } else {
- var7 = this.getRolloverIcon();
- }
- } else if (this.model.isSelected()) {
- var7 = this.getSelectedIcon();
- }
-
- return !SwingUtilities.doesIconReferenceImage(var7, var1) ? false : super.imageUpdate(var1, var2, var3, var4, var5, var6);
- }
- }
-
- void setUIProperty(String var1, Object var2) {
- if (var1 == "borderPainted") {
- if (!this.borderPaintedSet) {
- this.setBorderPainted((Boolean)var2);
- this.borderPaintedSet = false;
- }
- } else if (var1 == "rolloverEnabled") {
- if (!this.rolloverEnabledSet) {
- this.setRolloverEnabled((Boolean)var2);
- this.rolloverEnabledSet = false;
- }
- } else if (var1 == "iconTextGap") {
- if (!this.iconTextGapSet) {
- this.setIconTextGap(((Number)var2).intValue());
- this.iconTextGapSet = false;
- }
- } else if (var1 == "contentAreaFilled") {
- if (!this.contentAreaFilledSet) {
- this.setContentAreaFilled((Boolean)var2);
- this.contentAreaFilledSet = false;
- }
- } else {
- super.setUIProperty(var1, var2);
- }
-
- }
-
- protected String paramString() {
- String var1 = this.defaultIcon != null && this.defaultIcon != this ? this.defaultIcon.toString() : "";
- String var2 = this.pressedIcon != null && this.pressedIcon != this ? this.pressedIcon.toString() : "";
- String var3 = this.disabledIcon != null && this.disabledIcon != this ? this.disabledIcon.toString() : "";
- String var4 = this.selectedIcon != null && this.selectedIcon != this ? this.selectedIcon.toString() : "";
- String var5 = this.disabledSelectedIcon != null && this.disabledSelectedIcon != this ? this.disabledSelectedIcon.toString() : "";
- String var6 = this.rolloverIcon != null && this.rolloverIcon != this ? this.rolloverIcon.toString() : "";
- String var7 = this.rolloverSelectedIcon != null && this.rolloverSelectedIcon != this ? this.rolloverSelectedIcon.toString() : "";
- String var8 = this.paintBorder ? "true" : "false";
- String var9 = this.paintFocus ? "true" : "false";
- String var10 = this.rolloverEnabled ? "true" : "false";
- return super.paramString() + ",defaultIcon=" + var1 + ",disabledIcon=" + var3 + ",disabledSelectedIcon=" + var5 + ",margin=" + this.margin + ",paintBorder=" + var8 + ",paintFocus=" + var9 + ",pressedIcon=" + var2 + ",rolloverEnabled=" + var10 + ",rolloverIcon=" + var6 + ",rolloverSelectedIcon=" + var7 + ",selectedIcon=" + var4 + ",text=" + this.text;
- }
-
- private Handler getHandler() {
- if (this.handler == null) {
- this.handler = new Handler(this);
- }
-
- return this.handler;
- }
-
- // $FF: synthetic method
- static Handler access$000(AbstractButton var0) {
- return var0.getHandler();
- }
-
- // $FF: synthetic method
- static void access$100(AbstractButton var0) {
- var0.updateMnemonicProperties();
- }
- }
-