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

📄 abstractbutton.java

📁 linux下编程用 编译软件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    {      return null; // TODO    }    public int getAccessibleActionCount()    {      return 0; // TODO    }    public String getAccessibleActionDescription(int value0)    {      return null; // TODO    }    public boolean doAccessibleAction(int value0)    {      return false; // TODO    }    public Number getCurrentAccessibleValue()    {      return null; // TODO    }    public boolean setCurrentAccessibleValue(Number value0)    {      return false; // TODO    }    public Number getMinimumAccessibleValue()    {      return null; // TODO    }    public Number getMaximumAccessibleValue()    {      return null; // TODO    }    public AccessibleText getAccessibleText()    {      return null; // TODO    }    public int getIndexAtPoint(Point value0)    {      return 0; // TODO    }    public Rectangle getCharacterBounds(int value0)    {      return null; // TODO    }    public int getCharCount()    {      return 0; // TODO    }    public int getCaretPosition()    {      return 0; // TODO    }    public String getAtIndex(int value0, int value1)    {      return null; // TODO    }    public String getAfterIndex(int value0, int value1)    {      return null; // TODO    }    public String getBeforeIndex(int value0, int value1)    {      return null; // TODO    }    public AttributeSet getCharacterAttribute(int value0)    {      return null; // TODO    }    public int getSelectionStart()    {      return 0; // TODO    }    public int getSelectionEnd()    {      return 0; // TODO    }    public String getSelectedText()    {      return null; // TODO    }    private Rectangle getTextRectangle()    {      return null; // TODO    }  }  /**   * Creates a new AbstractButton object. Subclasses should call the following   * sequence in their constructor in order to initialize the button correctly:   * <pre>   * super();   * init(text, icon);   * </pre>   *   * The {@link #init(String, Icon)} method is not called automatically by this   * constructor.   *   * @see #init(String, Icon)   */  public AbstractButton()  {    actionListener = createActionListener();    changeListener = createChangeListener();    itemListener = createItemListener();    horizontalAlignment = CENTER;    horizontalTextPosition = TRAILING;    verticalAlignment = CENTER;    verticalTextPosition = CENTER;    borderPainted = true;    contentAreaFilled = true;    focusPainted = true;    setFocusable(true);    setAlignmentX(CENTER_ALIGNMENT);    setAlignmentY(CENTER_ALIGNMENT);    setDisplayedMnemonicIndex(-1);    setOpaque(true);    text = "";    updateUI();  }  /**   * Get the model the button is currently using.   *   * @return The current model   */  public ButtonModel getModel()  {      return model;  }  /**   * Set the model the button is currently using. This un-registers all    * listeners associated with the current model, and re-registers them   * with the new model.   *   * @param newModel The new model   */  public void setModel(ButtonModel newModel)  {    if (newModel == model)      return;    if (model != null)      {        model.removeActionListener(actionListener);        model.removeChangeListener(changeListener);        model.removeItemListener(itemListener);      }    ButtonModel old = model;    model = newModel;    if (model != null)      {        model.addActionListener(actionListener);        model.addChangeListener(changeListener);        model.addItemListener(itemListener);      }    firePropertyChange(MODEL_CHANGED_PROPERTY, old, model);    revalidate();    repaint();  } protected void init(String text, Icon icon)  {    // If text is null, we fall back to the empty    // string (which is set using AbstractButton's    // constructor).    // This way the behavior of the JDK is matched.    if(text != null)        this.text = text;    if (icon != null)      default_icon = icon; }   /**   * <p>Returns the action command string for this button's model.</p>   *   * <p>If the action command was set to <code>null</code>, the button's   * text (label) is returned instead.</p>   *   * @return The current action command string from the button's model   */  public String getActionCommand()  {    String ac = model.getActionCommand();    if (ac != null)      return ac;    else      return text;  }  /**   * Sets the action command string for this button's model.   *   * @param actionCommand The new action command string to set in the button's   * model.   */  public void setActionCommand(String actionCommand)  {    if (model != null)      model.setActionCommand(actionCommand);  }  /**   * Adds an ActionListener to the button's listener list. When the   * button's model is clicked it fires an ActionEvent, and these   * listeners will be called.   *   * @param l The new listener to add   */  public void addActionListener(ActionListener l)  {    listenerList.add(ActionListener.class, l);  }  /**   * Removes an ActionListener from the button's listener list.   *   * @param l The listener to remove   */  public void removeActionListener(ActionListener l)  {    listenerList.remove(ActionListener.class, l);  }  /**   * Returns all added <code>ActionListener</code> objects.   *    * @return an array of listeners   *    * @since 1.4   */  public ActionListener[] getActionListeners()  {    return (ActionListener[]) listenerList.getListeners(ActionListener.class);  }  /**   * Adds an ItemListener to the button's listener list. When the button's   * model changes state (between any of ARMED, ENABLED, PRESSED, ROLLOVER   * or SELECTED) it fires an ItemEvent, and these listeners will be   * called.   *   * @param l The new listener to add   */  public void addItemListener(ItemListener l)  {    listenerList.add(ItemListener.class, l);  }  /**   * Removes an ItemListener from the button's listener list.   *   * @param l The listener to remove   */  public void removeItemListener(ItemListener l)  {    listenerList.remove(ItemListener.class, l);  }  /**   * Returns all added <code>ItemListener</code> objects.   *    * @return an array of listeners   *    * @since 1.4   */  public ItemListener[] getItemListeners()  {    return (ItemListener[]) listenerList.getListeners(ItemListener.class);  }  /**   * Adds a ChangeListener to the button's listener list. When the button's   * model changes any of its (non-bound) properties, these listeners will be   * called.    *   * @param l The new listener to add   */  public void addChangeListener(ChangeListener l)  {    listenerList.add(ChangeListener.class, l);  }  /**   * Removes a ChangeListener from the button's listener list.   *   * @param l The listener to remove   */  public void removeChangeListener(ChangeListener l)  {    listenerList.remove(ChangeListener.class, l);  }  /**   * Returns all added <code>ChangeListener</code> objects.   *    * @return an array of listeners   *    * @since 1.4   */  public ChangeListener[] getChangeListeners()  {    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);  }  /**   * Calls {@link ItemListener#itemStateChanged} on each ItemListener in   * the button's listener list.   *   * @param e The event signifying that the button's model changed state   */  protected void fireItemStateChanged(ItemEvent e)  {    e.setSource(this);    ItemListener[] listeners = getItemListeners();     for (int i = 0; i < listeners.length; i++)      listeners[i].itemStateChanged(e);  }  /**   * Calls {@link ActionListener#actionPerformed} on each {@link   * ActionListener} in the button's listener list.   *   * @param e The event signifying that the button's model was clicked   */  protected void fireActionPerformed(ActionEvent e)  {	// Dispatch a copy of the given ActionEvent in order to	// set the source and action command correctly.    ActionEvent ae = new ActionEvent(        this,        e.getID(),        getActionCommand(),        e.getWhen(),        e.getModifiers());    ActionListener[] listeners = getActionListeners();        for (int i = 0; i < listeners.length; i++)      listeners[i].actionPerformed(ae);  }  /**   * Calls {@link ChangeListener#stateChanged} on each {@link ChangeListener}   * in the button's listener list.   */  protected void fireStateChanged()  {    ChangeListener[] listeners = getChangeListeners();    for (int i = 0; i < listeners.length; i++)      listeners[i].stateChanged(changeEvent);  }  /**   * Get the current keyboard mnemonic value. This value corresponds to a   * single key code (one of the {@link java.awt.event.KeyEvent} VK_*   * codes) and is used to activate the button when pressed in conjunction   * with the "mouseless modifier" of the button's look and feel class, and   * when focus is in one of the button's ancestors.   *   * @return The button's current keyboard mnemonic   */  public int getMnemonic()  {    ButtonModel mod = getModel();    if (mod != null)      return mod.getMnemonic();    return -1;  }  /**   * Set the current keyboard mnemonic value. This value corresponds to a   * single key code (one of the {@link java.awt.event.KeyEvent} VK_*   * codes) and is used to activate the button when pressed in conjunction   * with the "mouseless modifier" of the button's look and feel class, and   * when focus is in one of the button's ancestors.   *   * @param mne A new mnemonic to use for the button   */  public void setMnemonic(char mne)  {    setMnemonic((int) mne);  }  /**

⌨️ 快捷键说明

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