Class RunnableAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public class RunnableAction extends LocalizedAction
Action that invokes a Runnable. GUI components based on this action are typically represented by a button or menu item.
See Also:
  • Constructor Details

    • RunnableAction

      public RunnableAction(String id, Localization localization, Runnable runnable)
      Constructs a new runnable action.
      Parameters:
      id - the id for localization
      localization - the source for localization strings
      runnable - the callback function invoked when this action is triggered
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
    • toButton

      public JButton toButton()
      Convenience method to create a JButton based on this action.
      Returns:
      the button
    • toMenuItem

      public JMenuItem toMenuItem()
      Convenience method to create a JMenuItem based on this action.
      Returns:
      the menu item