Class Command

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

    public class Command
    extends javax.swing.AbstractAction
    This class represents UI-commands, which can be used as menu or toolbar items
    . When the Command object receives action event, that object's doit method is invoked. doit method by default does nothing and the class customer have to override it to implement any action handling logic. Originally contributed by: Juergen Verwohlt: Juergen.Verwohlt@jcatalog.com, Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com, Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      Command​(java.lang.String name, int mnemonic)
      Creates Command object with a given name and sets the name as a tooltip text.
      Command​(java.lang.String name, java.lang.String iconName)
      Creates Command object with a given name, the same tooltip text and icon image if appropriate image file is found.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      void doit()
      Action handler, have to be overrided by subclasses.
      • Methods inherited from class javax.swing.AbstractAction

        addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Constructor Detail

      • Command

        public Command​(java.lang.String name,
                       int mnemonic)
        Creates Command object with a given name and sets the name as a tooltip text. No associated icon image.
        Parameters:
        name - of the command
        mnemonic - A Key
      • Command

        public Command​(java.lang.String name,
                       java.lang.String iconName)
        Creates Command object with a given name, the same tooltip text and icon image if appropriate image file is found.
        Parameters:
        name - name of the command
        iconName - name of the icon
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
      • doit

        public void doit()
        Action handler, have to be overrided by subclasses.