⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultbuttonmodel.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   * @param e The ActionEvent to fire   */  protected void fireActionPerformed(ActionEvent e)  {    ActionListener[] ll = getActionListeners();    for (int i = 0; i < ll.length; i++)      ll[i].actionPerformed(e);  }  /**   * Inform each ChangeListener in the {@link #listenerList} that a ChangeEvent   * has occurred. This happens in response to the any change to a property   * of the model.   */  protected void fireStateChanged()  {    ChangeListener[] ll = getChangeListeners();    for (int i = 0; i < ll.length; i++)      ll[i].stateChanged(changeEvent);  }  /**   * Get the value of the model's "armed" property.   *   * @return The current "armed" property   */  public boolean isArmed()  {    return (stateMask & ARMED) == ARMED;  }  /**   * Set the value of the model's "armed" property.   *   * @param a The new "armed" property   */  public void setArmed(boolean a)  {    // if this call does not represent a CHANGE in state, then return    if ((a && isArmed()) || (!a && !isArmed()))      return;        // cannot change ARMED state unless button is enabled    if (!isEnabled())      return;    // make the change    if (a)      stateMask = stateMask | ARMED;    else      stateMask = stateMask & (~ARMED);    // notify interested ChangeListeners    fireStateChanged();  }  /**   * Get the value of the model's "enabled" property.   *   * @return The current "enabled" property.   */  public boolean isEnabled()  {    return (stateMask & ENABLED) == ENABLED;  }  /**   * Set the value of the model's "enabled" property.   *   * @param e The new "enabled" property   */  public void setEnabled(boolean e)  {    // if this call does not represent a CHANGE in state, then return    if ((e && isEnabled()) || (!e && !isEnabled()))      return;    // make the change    if (e)      stateMask = stateMask | ENABLED;    else      stateMask = stateMask & (~ENABLED);    // notify interested ChangeListeners    fireStateChanged();  }  /**   * Set the value of the model's "pressed" property.   *   * @param p The new "pressed" property   */  public void setPressed(boolean p)  {    // if this call does not represent a CHANGE in state, then return    if ((p && isPressed()) || (!p && !isPressed()))      return;    // cannot changed PRESSED state unless button is enabled    if (!isEnabled())      return;    // make the change    if (p)      stateMask = stateMask | PRESSED;    else      stateMask = stateMask & (~PRESSED);    // if button is armed and was released, fire action event    if (!p && isArmed())      fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,                                          actionCommand));    // notify interested ChangeListeners    fireStateChanged();  }  /**   * Get the value of the model's "pressed" property.   *   * @return The current "pressed" property   */  public boolean isPressed()  {    return (stateMask & PRESSED) == PRESSED;  }  /**   * Set the value of the model's "rollover" property.   *   * @param r The new "rollover" property   */  public void setRollover(boolean r)  {    // if this call does not represent a CHANGE in state, then return    if ((r && isRollover()) || (!r && !isRollover()))      return;        // cannot set ROLLOVER property unless button is enabled    if (!isEnabled())      return;    // make the change    if (r)      stateMask = stateMask | ROLLOVER;    else      stateMask = stateMask & (~ROLLOVER);    // notify interested ChangeListeners    fireStateChanged();  }  /**   * Set the value of the model's "selected" property.   *   * @param s The new "selected" property   */  public void setSelected(boolean s)  {    // if this call does not represent a CHANGE in state, then return    if ((s && isSelected()) || (!s && !isSelected()))      return;        // make the change    if (s)      stateMask = stateMask | SELECTED;    else      stateMask = stateMask & (~SELECTED);    // notify interested ChangeListeners    fireStateChanged();    // fire ItemStateChanged events    if (s)      {        fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,                                           null, ItemEvent.SELECTED));        if (group != null)          group.setSelected(this, true);      }    else      {        fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,                                           null, ItemEvent.DESELECTED));        if (group != null)          group.setSelected(this, false);      }  }  /**   * Get the value of the model's "selected" property.   *   * @return The current "selected" property   */  public boolean isSelected()  {    return (stateMask & SELECTED) == SELECTED;  }  /**   * Get the value of the model's "rollover" property.   *   * @return The current "rollover" property   */  public boolean isRollover()  {    return (stateMask & ROLLOVER) == ROLLOVER;  }  /**   * Get the value of the model's "mnemonic" property.   *   * @return The current "mnemonic" property   */  public int getMnemonic()  {    return mnemonic;  }  /**   * Set the value of the model's "mnemonic" property.   *   * @param key The new "mnemonic" property   */  public void setMnemonic(int key)  {    if (mnemonic != key)      {        mnemonic = key;        fireStateChanged();      }  }  /**   * Set the value of the model's "actionCommand" property. This property is   * used as the "command" property of the {@link ActionEvent} fired from the   * model.   *   * @param s The new "actionCommand" property.   */  public void setActionCommand(String s)  {    if (actionCommand != s)      {        actionCommand = s;        fireStateChanged();      }  }  /**   * Returns the current value of the model's "actionCommand" property.   *   * @return The current "actionCommand" property   */  public String getActionCommand()  {    return actionCommand;  }  /**   * Set the value of the model's "group" property. The model is said to be a   * member of the {@link ButtonGroup} held in its "group" property, and only   * one model in a given group can have their "selected" property be   * <code>true</code> at a time.   *   * @param g The new "group" property   */  public void setGroup(ButtonGroup g)  {    if (group != g)      {        group = g;        fireStateChanged();      }  }  /**   * Returns the current value of the model's "group" property.   *   * @return The value of the "group" property   */  public ButtonGroup getGroup()  {    return group;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -