Class ActionButton

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener

public class ActionButton extends JComponent implements PropertyChangeListener
See Also:
  • Field Details

  • Constructor Details

    • ActionButton

      public ActionButton()
    • ActionButton

      public ActionButton(Action action)
  • Method Details

    • setShowText

      public void setShowText(boolean b)
    • setPermanentState

      public void setPermanentState(int state)
    • unsetPermanentState

      public void unsetPermanentState()
    • setIcon

      public void setIcon(Icon i)
    • getButtonState

      public int getButtonState()
      Returns the state of the button, either FLAT, UP, or DOWN
    • getPopupButtonState

      public int getPopupButtonState()
    • paintComponent

      public void paintComponent(Graphics g)
      Called to paint the component
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - the graphics context to paint to
    • getIcon

      public Icon getIcon()
      Returns the icon to use depending on the state of the button.
    • paintBorder

      public void paintBorder(Graphics g, Rectangle rect, boolean invert)
      Paints a border around given rectangle
      Parameters:
      g - the graphics context to paint to
      rect - the bounding rectangle of the border
      invert - true if the button is pressed, false if it not pressed
    • hasPopupMenu

      public boolean hasPopupMenu()
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getHeight

      public int getHeight()
      Overrides:
      getHeight in class JComponent
    • getWidth

      public int getWidth()
      Overrides:
      getWidth in class JComponent
    • processMouseEvent

      protected void processMouseEvent(MouseEvent event)
      Processes a given mouse event. Sets the state variables to the state determined by the mouse event. Proccess mouse ENTERED,EXITED,PRESSES,RELEASED events.
      Overrides:
      processMouseEvent in class JComponent
    • insets

      public Insets insets()
      Overrides:
      insets in class Container
    • setInsets

      public void setInsets(Insets insets)
    • setButtonAction

      public void setButtonAction(Action action)
    • setAction

      public void setAction(Action action)
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      evt -
      See Also: