Class CButton


public class CButton extends CDropDownItem<CommonSimpleButtonAction>
A simple button, the user clicks onto the button and action() is called.
Author:
Benjamin Sigg
  • Constructor Details

    • CButton

      public CButton()
      Creates the new button
    • CButton

      protected CButton(CommonSimpleButtonAction action)
      Creates and initializes this button.
      Parameters:
      action - the action that represents this action, can be null but then subclasses have to call init(CommonSimpleButtonAction)
    • CButton

      public CButton(String text, Icon icon)
      Creates a new button.
      Parameters:
      text - the text of this button
      icon - the icon of this button
  • Method Details

    • init

      protected void init(CommonSimpleButtonAction action)
      Description copied from class: CDecorateableAction
      Initializes this action, this method can be called only once.
      Overrides:
      init in class CDecorateableAction<CommonSimpleButtonAction>
      Parameters:
      action - the internal representation
    • addActionListener

      public void addActionListener(ActionListener listener)
      Adds listener to this button, listener will be called whenever this button it triggered.
      Parameters:
      listener - the new listener, not null
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Removes listener from this button.
      Parameters:
      listener - the listener to remove
    • action

      protected void action()
      Invoked when the user clicks onto this button. The default behavior is to call fire().
    • fire

      protected void fire()
      Informs all ActionListeners that this button was clicked.