home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / AbstractButton.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  18.7 KB  |  1,074 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Graphics;
  6. import java.awt.Image;
  7. import java.awt.Insets;
  8. import java.awt.ItemSelectable;
  9. import java.awt.LayoutManager;
  10. import java.awt.Rectangle;
  11. import java.awt.event.ActionEvent;
  12. import java.awt.event.ActionListener;
  13. import java.awt.event.ItemEvent;
  14. import java.awt.event.ItemListener;
  15. import java.beans.PropertyChangeListener;
  16. import javax.accessibility.AccessibleState;
  17. import javax.swing.event.ChangeEvent;
  18. import javax.swing.event.ChangeListener;
  19. import javax.swing.plaf.ButtonUI;
  20. import javax.swing.plaf.UIResource;
  21.  
  22. public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
  23.    public static final String MODEL_CHANGED_PROPERTY = "model";
  24.    public static final String TEXT_CHANGED_PROPERTY = "text";
  25.    public static final String MNEMONIC_CHANGED_PROPERTY = "mnemonic";
  26.    public static final String MARGIN_CHANGED_PROPERTY = "margin";
  27.    public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY = "verticalAlignment";
  28.    public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY = "horizontalAlignment";
  29.    public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY = "verticalTextPosition";
  30.    public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY = "horizontalTextPosition";
  31.    public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
  32.    public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
  33.    public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY = "rolloverEnabled";
  34.    public static final String CONTENT_AREA_FILLED_CHANGED_PROPERTY = "contentAreaFilled";
  35.    public static final String ICON_CHANGED_PROPERTY = "icon";
  36.    public static final String PRESSED_ICON_CHANGED_PROPERTY = "pressedIcon";
  37.    public static final String SELECTED_ICON_CHANGED_PROPERTY = "selectedIcon";
  38.    public static final String ROLLOVER_ICON_CHANGED_PROPERTY = "rolloverIcon";
  39.    public static final String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY = "rolloverSelectedIcon";
  40.    public static final String DISABLED_ICON_CHANGED_PROPERTY = "disabledIcon";
  41.    public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY = "disabledSelectedIcon";
  42.    protected ButtonModel model = null;
  43.    private String text = "";
  44.    private Insets margin = null;
  45.    private Insets defaultMargin = null;
  46.    private Icon defaultIcon = null;
  47.    private Icon pressedIcon = null;
  48.    private Icon disabledIcon = null;
  49.    private Icon selectedIcon = null;
  50.    private Icon disabledSelectedIcon = null;
  51.    private Icon rolloverIcon = null;
  52.    private Icon rolloverSelectedIcon = null;
  53.    private boolean paintBorder = true;
  54.    private boolean paintFocus = true;
  55.    private boolean rolloverEnabled = false;
  56.    private boolean contentAreaFilled = true;
  57.    private int verticalAlignment = 0;
  58.    private int horizontalAlignment = 0;
  59.    private int verticalTextPosition = 0;
  60.    private int horizontalTextPosition = 11;
  61.    private int iconTextGap = 4;
  62.    private int mnemonic;
  63.    private int mnemonicIndex = -1;
  64.    private long multiClickThreshhold = 0L;
  65.    private boolean borderPaintedSet = false;
  66.    private boolean rolloverEnabledSet = false;
  67.    private boolean iconTextGapSet = false;
  68.    private boolean contentAreaFilledSet = false;
  69.    private boolean setLayout = false;
  70.    boolean defaultCapable = true;
  71.    private Handler handler;
  72.    protected ChangeListener changeListener = null;
  73.    protected ActionListener actionListener = null;
  74.    protected ItemListener itemListener = null;
  75.    protected transient ChangeEvent changeEvent;
  76.    private boolean hideActionText = false;
  77.    private Action action;
  78.    private PropertyChangeListener actionPropertyChangeListener;
  79.  
  80.    public void setHideActionText(boolean var1) {
  81.       if (var1 != this.hideActionText) {
  82.          this.hideActionText = var1;
  83.          if (this.getAction() != null) {
  84.             this.setTextFromAction(this.getAction(), false);
  85.          }
  86.  
  87.          this.firePropertyChange("hideActionText", !var1, var1);
  88.       }
  89.  
  90.    }
  91.  
  92.    public boolean getHideActionText() {
  93.       return this.hideActionText;
  94.    }
  95.  
  96.    public String getText() {
  97.       return this.text;
  98.    }
  99.  
  100.    public void setText(String var1) {
  101.       String var2 = this.text;
  102.       this.text = var1;
  103.       this.firePropertyChange("text", var2, var1);
  104.       this.updateDisplayedMnemonicIndex(var1, this.getMnemonic());
  105.       if (this.accessibleContext != null) {
  106.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  107.       }
  108.  
  109.       if (var1 == null || var2 == null || !var1.equals(var2)) {
  110.          this.revalidate();
  111.          this.repaint();
  112.       }
  113.  
  114.    }
  115.  
  116.    public boolean isSelected() {
  117.       return this.model.isSelected();
  118.    }
  119.  
  120.    public void setSelected(boolean var1) {
  121.       boolean var2 = this.isSelected();
  122.       this.model.setSelected(var1);
  123.    }
  124.  
  125.    public void doClick() {
  126.       this.doClick(68);
  127.    }
  128.  
  129.    public void doClick(int var1) {
  130.       Dimension var2 = this.getSize();
  131.       this.model.setArmed(true);
  132.       this.model.setPressed(true);
  133.       this.paintImmediately(new Rectangle(0, 0, var2.width, var2.height));
  134.  
  135.       try {
  136.          Thread.currentThread();
  137.          Thread.sleep((long)var1);
  138.       } catch (InterruptedException var4) {
  139.       }
  140.  
  141.       this.model.setPressed(false);
  142.       this.model.setArmed(false);
  143.    }
  144.  
  145.    public void setMargin(Insets var1) {
  146.       if (var1 instanceof UIResource) {
  147.          this.defaultMargin = var1;
  148.       } else if (this.margin instanceof UIResource) {
  149.          this.defaultMargin = this.margin;
  150.       }
  151.  
  152.       if (var1 == null && this.defaultMargin != null) {
  153.          var1 = this.defaultMargin;
  154.       }
  155.  
  156.       Insets var2 = this.margin;
  157.       this.margin = var1;
  158.       this.firePropertyChange("margin", var2, var1);
  159.       if (var2 == null || !var2.equals(var1)) {
  160.          this.revalidate();
  161.          this.repaint();
  162.       }
  163.  
  164.    }
  165.  
  166.    public Insets getMargin() {
  167.       return this.margin == null ? null : (Insets)this.margin.clone();
  168.    }
  169.  
  170.    public Icon getIcon() {
  171.       return this.defaultIcon;
  172.    }
  173.  
  174.    public void setIcon(Icon var1) {
  175.       Icon var2 = this.defaultIcon;
  176.       this.defaultIcon = var1;
  177.       if (var1 != var2 && this.disabledIcon instanceof UIResource) {
  178.          this.disabledIcon = null;
  179.       }
  180.  
  181.       this.firePropertyChange("icon", var2, var1);
  182.       if (this.accessibleContext != null) {
  183.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  184.       }
  185.  
  186.       if (var1 != var2) {
  187.          if (var1 == null || var2 == null || var1.getIconWidth() != var2.getIconWidth() || var1.getIconHeight() != var2.getIconHeight()) {
  188.             this.revalidate();
  189.          }
  190.  
  191.          this.repaint();
  192.       }
  193.  
  194.    }
  195.  
  196.    public Icon getPressedIcon() {
  197.       return this.pressedIcon;
  198.    }
  199.  
  200.    public void setPressedIcon(Icon var1) {
  201.       Icon var2 = this.pressedIcon;
  202.       this.pressedIcon = var1;
  203.       this.firePropertyChange("pressedIcon", var2, var1);
  204.       if (this.accessibleContext != null) {
  205.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  206.       }
  207.  
  208.       if (var1 != var2 && this.getModel().isPressed()) {
  209.          this.repaint();
  210.       }
  211.  
  212.    }
  213.  
  214.    public Icon getSelectedIcon() {
  215.       return this.selectedIcon;
  216.    }
  217.  
  218.    public void setSelectedIcon(Icon var1) {
  219.       Icon var2 = this.selectedIcon;
  220.       this.selectedIcon = var1;
  221.       if (var1 != var2 && this.disabledSelectedIcon instanceof UIResource) {
  222.          this.disabledSelectedIcon = null;
  223.       }
  224.  
  225.       this.firePropertyChange("selectedIcon", var2, var1);
  226.       if (this.accessibleContext != null) {
  227.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  228.       }
  229.  
  230.       if (var1 != var2 && this.isSelected()) {
  231.          this.repaint();
  232.       }
  233.  
  234.    }
  235.  
  236.    public Icon getRolloverIcon() {
  237.       return this.rolloverIcon;
  238.    }
  239.  
  240.    public void setRolloverIcon(Icon var1) {
  241.       Icon var2 = this.rolloverIcon;
  242.       this.rolloverIcon = var1;
  243.       this.firePropertyChange("rolloverIcon", var2, var1);
  244.       if (this.accessibleContext != null) {
  245.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  246.       }
  247.  
  248.       this.setRolloverEnabled(true);
  249.       if (var1 != var2) {
  250.          this.repaint();
  251.       }
  252.  
  253.    }
  254.  
  255.    public Icon getRolloverSelectedIcon() {
  256.       return this.rolloverSelectedIcon;
  257.    }
  258.  
  259.    public void setRolloverSelectedIcon(Icon var1) {
  260.       Icon var2 = this.rolloverSelectedIcon;
  261.       this.rolloverSelectedIcon = var1;
  262.       this.firePropertyChange("rolloverSelectedIcon", var2, var1);
  263.       if (this.accessibleContext != null) {
  264.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  265.       }
  266.  
  267.       this.setRolloverEnabled(true);
  268.       if (var1 != var2 && this.isSelected()) {
  269.          this.repaint();
  270.       }
  271.  
  272.    }
  273.  
  274.    public Icon getDisabledIcon() {
  275.       if (this.disabledIcon == null) {
  276.          this.disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, this.getIcon());
  277.          if (this.disabledIcon != null) {
  278.             this.firePropertyChange("disabledIcon", (Object)null, this.disabledIcon);
  279.          }
  280.       }
  281.  
  282.       return this.disabledIcon;
  283.    }
  284.  
  285.    public void setDisabledIcon(Icon var1) {
  286.       Icon var2 = this.disabledIcon;
  287.       this.disabledIcon = var1;
  288.       this.firePropertyChange("disabledIcon", var2, var1);
  289.       if (this.accessibleContext != null) {
  290.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  291.       }
  292.  
  293.       if (var1 != var2 && !this.isEnabled()) {
  294.          this.repaint();
  295.       }
  296.  
  297.    }
  298.  
  299.    public Icon getDisabledSelectedIcon() {
  300.       if (this.disabledSelectedIcon == null) {
  301.          if (this.selectedIcon == null) {
  302.             return this.getDisabledIcon();
  303.          }
  304.  
  305.          this.disabledSelectedIcon = UIManager.getLookAndFeel().getDisabledSelectedIcon(this, this.getSelectedIcon());
  306.       }
  307.  
  308.       return this.disabledSelectedIcon;
  309.    }
  310.  
  311.    public void setDisabledSelectedIcon(Icon var1) {
  312.       Icon var2 = this.disabledSelectedIcon;
  313.       this.disabledSelectedIcon = var1;
  314.       this.firePropertyChange("disabledSelectedIcon", var2, var1);
  315.       if (this.accessibleContext != null) {
  316.          this.accessibleContext.firePropertyChange("AccessibleVisibleData", var2, var1);
  317.       }
  318.  
  319.       if (var1 != var2) {
  320.          if (var1 == null || var2 == null || var1.getIconWidth() != var2.getIconWidth() || var1.getIconHeight() != var2.getIconHeight()) {
  321.             this.revalidate();
  322.          }
  323.  
  324.          if (!this.isEnabled() && this.isSelected()) {
  325.             this.repaint();
  326.          }
  327.       }
  328.  
  329.    }
  330.  
  331.    public int getVerticalAlignment() {
  332.       return this.verticalAlignment;
  333.    }
  334.  
  335.    public void setVerticalAlignment(int var1) {
  336.       if (var1 != this.verticalAlignment) {
  337.          int var2 = this.verticalAlignment;
  338.          this.verticalAlignment = this.checkVerticalKey(var1, "verticalAlignment");
  339.          this.firePropertyChange("verticalAlignment", var2, this.verticalAlignment);
  340.          this.repaint();
  341.       }
  342.    }
  343.  
  344.    public int getHorizontalAlignment() {
  345.       return this.horizontalAlignment;
  346.    }
  347.  
  348.    public void setHorizontalAlignment(int var1) {
  349.       if (var1 != this.horizontalAlignment) {
  350.          int var2 = this.horizontalAlignment;
  351.          this.horizontalAlignment = this.checkHorizontalKey(var1, "horizontalAlignment");
  352.          this.firePropertyChange("horizontalAlignment", var2, this.horizontalAlignment);
  353.          this.repaint();
  354.       }
  355.    }
  356.  
  357.    public int getVerticalTextPosition() {
  358.       return this.verticalTextPosition;
  359.    }
  360.  
  361.    public void setVerticalTextPosition(int var1) {
  362.       if (var1 != this.verticalTextPosition) {
  363.          int var2 = this.verticalTextPosition;
  364.          this.verticalTextPosition = this.checkVerticalKey(var1, "verticalTextPosition");
  365.          this.firePropertyChange("verticalTextPosition", var2, this.verticalTextPosition);
  366.          this.revalidate();
  367.          this.repaint();
  368.       }
  369.    }
  370.  
  371.    public int getHorizontalTextPosition() {
  372.       return this.horizontalTextPosition;
  373.    }
  374.  
  375.    public void setHorizontalTextPosition(int var1) {
  376.       if (var1 != this.horizontalTextPosition) {
  377.          int var2 = this.horizontalTextPosition;
  378.          this.horizontalTextPosition = this.checkHorizontalKey(var1, "horizontalTextPosition");
  379.          this.firePropertyChange("horizontalTextPosition", var2, this.horizontalTextPosition);
  380.          this.revalidate();
  381.          this.repaint();
  382.       }
  383.    }
  384.  
  385.    public int getIconTextGap() {
  386.       return this.iconTextGap;
  387.    }
  388.  
  389.    public void setIconTextGap(int var1) {
  390.       int var2 = this.iconTextGap;
  391.       this.iconTextGap = var1;
  392.       this.iconTextGapSet = true;
  393.       this.firePropertyChange("iconTextGap", var2, var1);
  394.       if (var1 != var2) {
  395.          this.revalidate();
  396.          this.repaint();
  397.       }
  398.  
  399.    }
  400.  
  401.    protected int checkHorizontalKey(int var1, String var2) {
  402.       if (var1 != 2 && var1 != 0 && var1 != 4 && var1 != 10 && var1 != 11) {
  403.          throw new IllegalArgumentException(var2);
  404.       } else {
  405.          return var1;
  406.       }
  407.    }
  408.  
  409.    protected int checkVerticalKey(int var1, String var2) {
  410.       if (var1 != 1 && var1 != 0 && var1 != 3) {
  411.          throw new IllegalArgumentException(var2);
  412.       } else {
  413.          return var1;
  414.       }
  415.    }
  416.  
  417.    public void removeNotify() {
  418.       super.removeNotify();
  419.       if (this.isRolloverEnabled()) {
  420.          this.getModel().setRollover(false);
  421.       }
  422.  
  423.    }
  424.  
  425.    public void setActionCommand(String var1) {
  426.       this.getModel().setActionCommand(var1);
  427.    }
  428.  
  429.    public String getActionCommand() {
  430.       String var1 = this.getModel().getActionCommand();
  431.       if (var1 == null) {
  432.          var1 = this.getText();
  433.       }
  434.  
  435.       return var1;
  436.    }
  437.  
  438.    public void setAction(Action var1) {
  439.       Action var2 = this.getAction();
  440.       if (this.action == null || !this.action.equals(var1)) {
  441.          this.action = var1;
  442.          if (var2 != null) {
  443.             this.removeActionListener(var2);
  444.             var2.removePropertyChangeListener(this.actionPropertyChangeListener);
  445.             this.actionPropertyChangeListener = null;
  446.          }
  447.  
  448.          this.configurePropertiesFromAction(this.action);
  449.          if (this.action != null) {
  450.             if (!this.isListener(ActionListener.class, this.action)) {
  451.                this.addActionListener(this.action);
  452.             }
  453.  
  454.             this.actionPropertyChangeListener = this.createActionPropertyChangeListener(this.action);
  455.             this.action.addPropertyChangeListener(this.actionPropertyChangeListener);
  456.          }
  457.  
  458.          this.firePropertyChange("action", var2, this.action);
  459.       }
  460.  
  461.    }
  462.  
  463.    private boolean isListener(Class var1, ActionListener var2) {
  464.       boolean var3 = false;
  465.       Object[] var4 = this.listenerList.getListenerList();
  466.  
  467.       for(int var5 = var4.length - 2; var5 >= 0; var5 -= 2) {
  468.          if (var4[var5] == var1 && var4[var5 + 1] == var2) {
  469.             var3 = true;
  470.          }
  471.       }
  472.  
  473.       return var3;
  474.    }
  475.  
  476.    public Action getAction() {
  477.       return this.action;
  478.    }
  479.  
  480.    protected void configurePropertiesFromAction(Action var1) {
  481.       this.setMnemonicFromAction(var1);
  482.       this.setTextFromAction(var1, false);
  483.       AbstractAction.setToolTipTextFromAction(this, var1);
  484.       this.setIconFromAction(var1);
  485.       this.setActionCommandFromAction(var1);
  486.       AbstractAction.setEnabledFromAction(this, var1);
  487.       if (AbstractAction.hasSelectedKey(var1) && this.shouldUpdateSelectedStateFromAction()) {
  488.          this.setSelectedFromAction(var1);
  489.       }
  490.  
  491.       this.setDisplayedMnemonicIndexFromAction(var1, false);
  492.    }
  493.  
  494.    void clientPropertyChanged(Object var1, Object var2, Object var3) {
  495.       if (var1 == "hideActionText") {
  496.          boolean var4 = var3 instanceof Boolean ? (Boolean)var3 : false;
  497.          if (this.getHideActionText() != var4) {
  498.             this.setHideActionText(var4);
  499.          }
  500.       }
  501.  
  502.    }
  503.  
  504.    boolean shouldUpdateSelectedStateFromAction() {
  505.       return false;
  506.    }
  507.  
  508.    protected void actionPropertyChanged(Action var1, String var2) {
  509.       if (var2 == "Name") {
  510.          this.setTextFromAction(var1, true);
  511.       } else if (var2 == "enabled") {
  512.          AbstractAction.setEnabledFromAction(this, var1);
  513.       } else if (var2 == "ShortDescription") {
  514.          AbstractAction.setToolTipTextFromAction(this, var1);
  515.       } else if (var2 == "SmallIcon") {
  516.          this.smallIconChanged(var1);
  517.       } else if (var2 == "MnemonicKey") {
  518.          this.setMnemonicFromAction(var1);
  519.       } else if (var2 == "ActionCommandKey") {
  520.          this.setActionCommandFromAction(var1);
  521.       } else if (var2 == "SwingSelectedKey" && AbstractAction.hasSelectedKey(var1) && this.shouldUpdateSelectedStateFromAction()) {
  522.          this.setSelectedFromAction(var1);
  523.       } else if (var2 == "SwingDisplayedMnemonicIndexKey") {
  524.          this.setDisplayedMnemonicIndexFromAction(var1, true);
  525.       } else if (var2 == "SwingLargeIconKey") {
  526.          this.largeIconChanged(var1);
  527.       }
  528.  
  529.    }
  530.  
  531.    private void setDisplayedMnemonicIndexFromAction(Action var1, boolean var2) {
  532.       Integer var3 = var1 == null ? null : (Integer)var1.getValue("SwingDisplayedMnemonicIndexKey");
  533.       if (var2 || var3 != null) {
  534.          int var4;
  535.          if (var3 == null) {
  536.             var4 = -1;
  537.          } else {
  538.             var4 = var3;
  539.             String var5 = this.getText();
  540.             if (var5 == null || var4 >= var5.length()) {
  541.                var4 = -1;
  542.             }
  543.          }
  544.  
  545.          this.setDisplayedMnemonicIndex(var4);
  546.       }
  547.  
  548.    }
  549.  
  550.    private void setMnemonicFromAction(Action var1) {
  551.       Integer var2 = var1 == null ? null : (Integer)var1.getValue("MnemonicKey");
  552.       this.setMnemonic(var2 == null ? 0 : var2);
  553.    }
  554.  
  555.    private void setTextFromAction(Action var1, boolean var2) {
  556.       boolean var3 = this.getHideActionText();
  557.       if (!var2) {
  558.          this.setText(var1 != null && !var3 ? (String)var1.getValue("Name") : null);
  559.       } else if (!var3) {
  560.          this.setText((String)var1.getValue("Name"));
  561.       }
  562.  
  563.    }
  564.  
  565.    void setIconFromAction(Action var1) {
  566.       Icon var2 = null;
  567.       if (var1 != null) {
  568.          var2 = (Icon)var1.getValue("SwingLargeIconKey");
  569.          if (var2 == null) {
  570.             var2 = (Icon)var1.getValue("SmallIcon");
  571.          }
  572.       }
  573.  
  574.       this.setIcon(var2);
  575.    }
  576.  
  577.    void smallIconChanged(Action var1) {
  578.       if (var1.getValue("SwingLargeIconKey") == null) {
  579.          this.setIconFromAction(var1);
  580.       }
  581.  
  582.    }
  583.  
  584.    void largeIconChanged(Action var1) {
  585.       this.setIconFromAction(var1);
  586.    }
  587.  
  588.    private void setActionCommandFromAction(Action var1) {
  589.       this.setActionCommand(var1 != null ? (String)var1.getValue("ActionCommandKey") : null);
  590.    }
  591.  
  592.    private void setSelectedFromAction(Action var1) {
  593.       boolean var2 = false;
  594.       if (var1 != null) {
  595.          var2 = AbstractAction.isSelected(var1);
  596.       }
  597.  
  598.       if (var2 != this.isSelected()) {
  599.          this.setSelected(var2);
  600.          if (!var2 && this.isSelected() && this.getModel() instanceof DefaultButtonModel) {
  601.             ButtonGroup var3 = ((DefaultButtonModel)this.getModel()).getGroup();
  602.             if (var3 != null) {
  603.                var3.clearSelection();
  604.             }
  605.          }
  606.       }
  607.  
  608.    }
  609.  
  610.    protected PropertyChangeListener createActionPropertyChangeListener(Action var1) {
  611.       return this.createActionPropertyChangeListener0(var1);
  612.    }
  613.  
  614.    PropertyChangeListener createActionPropertyChangeListener0(Action var1) {
  615.       return new ButtonActionPropertyChangeListener(this, var1);
  616.    }
  617.  
  618.    public boolean isBorderPainted() {
  619.       return this.paintBorder;
  620.    }
  621.  
  622.    public void setBorderPainted(boolean var1) {
  623.       boolean var2 = this.paintBorder;
  624.       this.paintBorder = var1;
  625.       this.borderPaintedSet = true;
  626.       this.firePropertyChange("borderPainted", var2, this.paintBorder);
  627.       if (var1 != var2) {
  628.          this.revalidate();
  629.          this.repaint();
  630.       }
  631.  
  632.    }
  633.  
  634.    protected void paintBorder(Graphics var1) {
  635.       if (this.isBorderPainted()) {
  636.          super.paintBorder(var1);
  637.       }
  638.  
  639.    }
  640.  
  641.    public boolean isFocusPainted() {
  642.       return this.paintFocus;
  643.    }
  644.  
  645.    public void setFocusPainted(boolean var1) {
  646.       boolean var2 = this.paintFocus;
  647.       this.paintFocus = var1;
  648.       this.firePropertyChange("focusPainted", var2, this.paintFocus);
  649.       if (var1 != var2 && this.isFocusOwner()) {
  650.          this.revalidate();
  651.          this.repaint();
  652.       }
  653.  
  654.    }
  655.  
  656.    public boolean isContentAreaFilled() {
  657.       return this.contentAreaFilled;
  658.    }
  659.  
  660.    public void setContentAreaFilled(boolean var1) {
  661.       boolean var2 = this.contentAreaFilled;
  662.       this.contentAreaFilled = var1;
  663.       this.contentAreaFilledSet = true;
  664.       this.firePropertyChange("contentAreaFilled", var2, this.contentAreaFilled);
  665.       if (var1 != var2) {
  666.          this.repaint();
  667.       }
  668.  
  669.    }
  670.  
  671.    public boolean isRolloverEnabled() {
  672.       return this.rolloverEnabled;
  673.    }
  674.  
  675.    public void setRolloverEnabled(boolean var1) {
  676.       boolean var2 = this.rolloverEnabled;
  677.       this.rolloverEnabled = var1;
  678.       this.rolloverEnabledSet = true;
  679.       this.firePropertyChange("rolloverEnabled", var2, this.rolloverEnabled);
  680.       if (var1 != var2) {
  681.          this.repaint();
  682.       }
  683.  
  684.    }
  685.  
  686.    public int getMnemonic() {
  687.       return this.mnemonic;
  688.    }
  689.  
  690.    public void setMnemonic(int var1) {
  691.       int var2 = this.getMnemonic();
  692.       this.model.setMnemonic(var1);
  693.       this.updateMnemonicProperties();
  694.    }
  695.  
  696.    public void setMnemonic(char var1) {
  697.       int var2 = var1;
  698.       if (var1 >= 'a' && var1 <= 'z') {
  699.          var2 = var1 - 32;
  700.       }
  701.  
  702.       this.setMnemonic(var2);
  703.    }
  704.  
  705.    public void setDisplayedMnemonicIndex(int var1) throws IllegalArgumentException {
  706.       int var2 = this.mnemonicIndex;
  707.       if (var1 == -1) {
  708.          this.mnemonicIndex = -1;
  709.       } else {
  710.          String var3 = this.getText();
  711.          int var4 = var3 == null ? 0 : var3.length();
  712.          if (var1 < -1 || var1 >= var4) {
  713.             throw new IllegalArgumentException("index == " + var1);
  714.          }
  715.       }
  716.  
  717.       this.mnemonicIndex = var1;
  718.       this.firePropertyChange("displayedMnemonicIndex", var2, var1);
  719.       if (var1 != var2) {
  720.          this.revalidate();
  721.          this.repaint();
  722.       }
  723.  
  724.    }
  725.  
  726.    public int getDisplayedMnemonicIndex() {
  727.       return this.mnemonicIndex;
  728.    }
  729.  
  730.    private void updateDisplayedMnemonicIndex(String var1, int var2) {
  731.       this.setDisplayedMnemonicIndex(SwingUtilities.findDisplayedMnemonicIndex(var1, var2));
  732.    }
  733.  
  734.    private void updateMnemonicProperties() {
  735.       int var1 = this.model.getMnemonic();
  736.       if (this.mnemonic != var1) {
  737.          int var2 = this.mnemonic;
  738.          this.mnemonic = var1;
  739.          this.firePropertyChange("mnemonic", var2, this.mnemonic);
  740.          this.updateDisplayedMnemonicIndex(this.getText(), this.mnemonic);
  741.          this.revalidate();
  742.          this.repaint();
  743.       }
  744.  
  745.    }
  746.  
  747.    public void setMultiClickThreshhold(long var1) {
  748.       if (var1 < 0L) {
  749.          throw new IllegalArgumentException("threshhold must be >= 0");
  750.       } else {
  751.          this.multiClickThreshhold = var1;
  752.       }
  753.    }
  754.  
  755.    public long getMultiClickThreshhold() {
  756.       return this.multiClickThreshhold;
  757.    }
  758.  
  759.    public ButtonModel getModel() {
  760.       return this.model;
  761.    }
  762.  
  763.    public void setModel(ButtonModel var1) {
  764.       ButtonModel var2 = this.getModel();
  765.       if (var2 != null) {
  766.          var2.removeChangeListener(this.changeListener);
  767.          var2.removeActionListener(this.actionListener);
  768.          var2.removeItemListener(this.itemListener);
  769.          this.changeListener = null;
  770.          this.actionListener = null;
  771.          this.itemListener = null;
  772.       }
  773.  
  774.       this.model = var1;
  775.       if (var1 != null) {
  776.          this.changeListener = this.createChangeListener();
  777.          this.actionListener = this.createActionListener();
  778.          this.itemListener = this.createItemListener();
  779.          var1.addChangeListener(this.changeListener);
  780.          var1.addActionListener(this.actionListener);
  781.          var1.addItemListener(this.itemListener);
  782.          this.updateMnemonicProperties();
  783.          super.setEnabled(var1.isEnabled());
  784.       } else {
  785.          this.mnemonic = 0;
  786.       }
  787.  
  788.       this.updateDisplayedMnemonicIndex(this.getText(), this.mnemonic);
  789.       this.firePropertyChange("model", var2, var1);
  790.       if (var1 != var2) {
  791.          this.revalidate();
  792.          this.repaint();
  793.       }
  794.  
  795.    }
  796.  
  797.    public ButtonUI getUI() {
  798.       return (ButtonUI)this.ui;
  799.    }
  800.  
  801.    public void setUI(ButtonUI var1) {
  802.       super.setUI(var1);
  803.       if (this.disabledIcon instanceof UIResource) {
  804.          this.setDisabledIcon((Icon)null);
  805.       }
  806.  
  807.       if (this.disabledSelectedIcon instanceof UIResource) {
  808.          this.setDisabledSelectedIcon((Icon)null);
  809.       }
  810.  
  811.    }
  812.  
  813.    public void updateUI() {
  814.    }
  815.  
  816.    protected void addImpl(Component var1, Object var2, int var3) {
  817.       if (!this.setLayout) {
  818.          this.setLayout(new OverlayLayout(this));
  819.       }
  820.  
  821.       super.addImpl(var1, var2, var3);
  822.    }
  823.  
  824.    public void setLayout(LayoutManager var1) {
  825.       this.setLayout = true;
  826.       super.setLayout(var1);
  827.    }
  828.  
  829.    public void addChangeListener(ChangeListener var1) {
  830.       this.listenerList.add(ChangeListener.class, var1);
  831.    }
  832.  
  833.    public void removeChangeListener(ChangeListener var1) {
  834.       this.listenerList.remove(ChangeListener.class, var1);
  835.    }
  836.  
  837.    public ChangeListener[] getChangeListeners() {
  838.       return (ChangeListener[])this.listenerList.getListeners(ChangeListener.class);
  839.    }
  840.  
  841.    protected void fireStateChanged() {
  842.       Object[] var1 = this.listenerList.getListenerList();
  843.  
  844.       for(int var2 = var1.length - 2; var2 >= 0; var2 -= 2) {
  845.          if (var1[var2] == ChangeListener.class) {
  846.             if (this.changeEvent == null) {
  847.                this.changeEvent = new ChangeEvent(this);
  848.             }
  849.  
  850.             ((ChangeListener)var1[var2 + 1]).stateChanged(this.changeEvent);
  851.          }
  852.       }
  853.  
  854.    }
  855.  
  856.    public void addActionListener(ActionListener var1) {
  857.       this.listenerList.add(ActionListener.class, var1);
  858.    }
  859.  
  860.    public void removeActionListener(ActionListener var1) {
  861.       if (var1 != null && this.getAction() == var1) {
  862.          this.setAction((Action)null);
  863.       } else {
  864.          this.listenerList.remove(ActionListener.class, var1);
  865.       }
  866.  
  867.    }
  868.  
  869.    public ActionListener[] getActionListeners() {
  870.       return (ActionListener[])this.listenerList.getListeners(ActionListener.class);
  871.    }
  872.  
  873.    protected ChangeListener createChangeListener() {
  874.       return this.getHandler();
  875.    }
  876.  
  877.    protected void fireActionPerformed(ActionEvent var1) {
  878.       Object[] var2 = this.listenerList.getListenerList();
  879.       ActionEvent var3 = null;
  880.  
  881.       for(int var4 = var2.length - 2; var4 >= 0; var4 -= 2) {
  882.          if (var2[var4] == ActionListener.class) {
  883.             if (var3 == null) {
  884.                String var5 = var1.getActionCommand();
  885.                if (var5 == null) {
  886.                   var5 = this.getActionCommand();
  887.                }
  888.  
  889.                var3 = new ActionEvent(this, 1001, var5, var1.getWhen(), var1.getModifiers());
  890.             }
  891.  
  892.             ((ActionListener)var2[var4 + 1]).actionPerformed(var3);
  893.          }
  894.       }
  895.  
  896.    }
  897.  
  898.    protected void fireItemStateChanged(ItemEvent var1) {
  899.       Object[] var2 = this.listenerList.getListenerList();
  900.       ItemEvent var3 = null;
  901.  
  902.       for(int var4 = var2.length - 2; var4 >= 0; var4 -= 2) {
  903.          if (var2[var4] == ItemListener.class) {
  904.             if (var3 == null) {
  905.                var3 = new ItemEvent(this, 701, this, var1.getStateChange());
  906.             }
  907.  
  908.             ((ItemListener)var2[var4 + 1]).itemStateChanged(var3);
  909.          }
  910.       }
  911.  
  912.       if (this.accessibleContext != null) {
  913.          if (var1.getStateChange() == 1) {
  914.             this.accessibleContext.firePropertyChange("AccessibleState", (Object)null, AccessibleState.SELECTED);
  915.             this.accessibleContext.firePropertyChange("AccessibleValue", new Integer(0), new Integer(1));
  916.          } else {
  917.             this.accessibleContext.firePropertyChange("AccessibleState", AccessibleState.SELECTED, (Object)null);
  918.             this.accessibleContext.firePropertyChange("AccessibleValue", new Integer(1), new Integer(0));
  919.          }
  920.       }
  921.  
  922.    }
  923.  
  924.    protected ActionListener createActionListener() {
  925.       return this.getHandler();
  926.    }
  927.  
  928.    protected ItemListener createItemListener() {
  929.       return this.getHandler();
  930.    }
  931.  
  932.    public void setEnabled(boolean var1) {
  933.       if (!var1 && this.model.isRollover()) {
  934.          this.model.setRollover(false);
  935.       }
  936.  
  937.       super.setEnabled(var1);
  938.       this.model.setEnabled(var1);
  939.    }
  940.  
  941.    /** @deprecated */
  942.    @Deprecated
  943.    public String getLabel() {
  944.       return this.getText();
  945.    }
  946.  
  947.    /** @deprecated */
  948.    @Deprecated
  949.    public void setLabel(String var1) {
  950.       this.setText(var1);
  951.    }
  952.  
  953.    public void addItemListener(ItemListener var1) {
  954.       this.listenerList.add(ItemListener.class, var1);
  955.    }
  956.  
  957.    public void removeItemListener(ItemListener var1) {
  958.       this.listenerList.remove(ItemListener.class, var1);
  959.    }
  960.  
  961.    public ItemListener[] getItemListeners() {
  962.       return (ItemListener[])this.listenerList.getListeners(ItemListener.class);
  963.    }
  964.  
  965.    public Object[] getSelectedObjects() {
  966.       if (!this.isSelected()) {
  967.          return null;
  968.       } else {
  969.          Object[] var1 = new Object[]{this.getText()};
  970.          return var1;
  971.       }
  972.    }
  973.  
  974.    protected void init(String var1, Icon var2) {
  975.       if (var1 != null) {
  976.          this.setText(var1);
  977.       }
  978.  
  979.       if (var2 != null) {
  980.          this.setIcon(var2);
  981.       }
  982.  
  983.       this.updateUI();
  984.       this.setAlignmentX(0.0F);
  985.       this.setAlignmentY(0.5F);
  986.    }
  987.  
  988.    public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
  989.       Icon var7 = this.getIcon();
  990.       if (var7 == null) {
  991.          return false;
  992.       } else {
  993.          if (!this.model.isEnabled()) {
  994.             if (this.model.isSelected()) {
  995.                var7 = this.getDisabledSelectedIcon();
  996.             } else {
  997.                var7 = this.getDisabledIcon();
  998.             }
  999.          } else if (this.model.isPressed() && this.model.isArmed()) {
  1000.             var7 = this.getPressedIcon();
  1001.          } else if (this.isRolloverEnabled() && this.model.isRollover()) {
  1002.             if (this.model.isSelected()) {
  1003.                var7 = this.getRolloverSelectedIcon();
  1004.             } else {
  1005.                var7 = this.getRolloverIcon();
  1006.             }
  1007.          } else if (this.model.isSelected()) {
  1008.             var7 = this.getSelectedIcon();
  1009.          }
  1010.  
  1011.          return !SwingUtilities.doesIconReferenceImage(var7, var1) ? false : super.imageUpdate(var1, var2, var3, var4, var5, var6);
  1012.       }
  1013.    }
  1014.  
  1015.    void setUIProperty(String var1, Object var2) {
  1016.       if (var1 == "borderPainted") {
  1017.          if (!this.borderPaintedSet) {
  1018.             this.setBorderPainted((Boolean)var2);
  1019.             this.borderPaintedSet = false;
  1020.          }
  1021.       } else if (var1 == "rolloverEnabled") {
  1022.          if (!this.rolloverEnabledSet) {
  1023.             this.setRolloverEnabled((Boolean)var2);
  1024.             this.rolloverEnabledSet = false;
  1025.          }
  1026.       } else if (var1 == "iconTextGap") {
  1027.          if (!this.iconTextGapSet) {
  1028.             this.setIconTextGap(((Number)var2).intValue());
  1029.             this.iconTextGapSet = false;
  1030.          }
  1031.       } else if (var1 == "contentAreaFilled") {
  1032.          if (!this.contentAreaFilledSet) {
  1033.             this.setContentAreaFilled((Boolean)var2);
  1034.             this.contentAreaFilledSet = false;
  1035.          }
  1036.       } else {
  1037.          super.setUIProperty(var1, var2);
  1038.       }
  1039.  
  1040.    }
  1041.  
  1042.    protected String paramString() {
  1043.       String var1 = this.defaultIcon != null && this.defaultIcon != this ? this.defaultIcon.toString() : "";
  1044.       String var2 = this.pressedIcon != null && this.pressedIcon != this ? this.pressedIcon.toString() : "";
  1045.       String var3 = this.disabledIcon != null && this.disabledIcon != this ? this.disabledIcon.toString() : "";
  1046.       String var4 = this.selectedIcon != null && this.selectedIcon != this ? this.selectedIcon.toString() : "";
  1047.       String var5 = this.disabledSelectedIcon != null && this.disabledSelectedIcon != this ? this.disabledSelectedIcon.toString() : "";
  1048.       String var6 = this.rolloverIcon != null && this.rolloverIcon != this ? this.rolloverIcon.toString() : "";
  1049.       String var7 = this.rolloverSelectedIcon != null && this.rolloverSelectedIcon != this ? this.rolloverSelectedIcon.toString() : "";
  1050.       String var8 = this.paintBorder ? "true" : "false";
  1051.       String var9 = this.paintFocus ? "true" : "false";
  1052.       String var10 = this.rolloverEnabled ? "true" : "false";
  1053.       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;
  1054.    }
  1055.  
  1056.    private Handler getHandler() {
  1057.       if (this.handler == null) {
  1058.          this.handler = new Handler(this);
  1059.       }
  1060.  
  1061.       return this.handler;
  1062.    }
  1063.  
  1064.    // $FF: synthetic method
  1065.    static Handler access$000(AbstractButton var0) {
  1066.       return var0.getHandler();
  1067.    }
  1068.  
  1069.    // $FF: synthetic method
  1070.    static void access$100(AbstractButton var0) {
  1071.       var0.updateMnemonicProperties();
  1072.    }
  1073. }
  1074.