Class MenuAction

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Client client  
      • 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
      MenuAction​(Client client)
      Creates a new MenuAction object reading its name, mnemonic and accelerator from the dictionary.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      This method is called whenever this action is invoked.
      javax.swing.KeyStroke getAccelerator()
      Returns the shortcut KeyStroke this menu action is to be invokable with.
      protected abstract java.lang.String getAcceleratorTranslated()
      Returns an accelerator key combination which should depend on the current GUI locale for a menu action.
      java.lang.String getIconName()
      Returns the name of an appropriate icon for this action.
      char getMnemonic()
      Returns the mnemonic of the menu this menu action is to be associated with.
      protected abstract java.lang.String getMnemonicTranslated()  
      protected java.lang.String getName()
      Returns the name of this menu action.
      protected abstract java.lang.String getNameTranslated()
      Returns an name which should depend on the current GUI locale for a menu action.
      java.lang.String getToolTip()
      Returns the tool tip for this menu action.
      protected abstract java.lang.String getTooltipTranslated()
      Returns a tool tip text which should depend on the current GUI locale for a menu action.
      abstract void menuActionPerformed​(java.awt.event.ActionEvent e)
      This method is called whenever this action is invoked.
      void setIcon​(java.lang.String aName)
      Sets the icon of this menu action by iconname.
      protected void setName​(java.lang.String name)
      Sets the name of this menu action.
      java.lang.String toString()
      Returns a String representation of this MenuAction object.
      • 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, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Field Detail

      • client

        protected Client client
    • Constructor Detail

      • MenuAction

        public MenuAction​(Client client)
        Creates a new MenuAction object reading its name, mnemonic and accelerator from the dictionary.
        Parameters:
        client - The client for this MenuAction object.
    • Method Detail

      • getNameTranslated

        protected abstract java.lang.String getNameTranslated()
        Returns an name which should depend on the current GUI locale for a menu action. May return null!
      • getMnemonicTranslated

        protected abstract java.lang.String getMnemonicTranslated()
      • getAcceleratorTranslated

        protected abstract java.lang.String getAcceleratorTranslated()
        Returns an accelerator key combination which should depend on the current GUI locale for a menu action. May return null!
        Returns:
        A KeyStroke description
        See Also:
        KeyStroke.getKeyStroke(String)
      • getTooltipTranslated

        protected abstract java.lang.String getTooltipTranslated()
        Returns a tool tip text which should depend on the current GUI locale for a menu action. May return null!
      • actionPerformed

        public final void actionPerformed​(java.awt.event.ActionEvent e)
        This method is called whenever this action is invoked.
      • menuActionPerformed

        public abstract void menuActionPerformed​(java.awt.event.ActionEvent e)
        This method is called whenever this action is invoked.
      • setName

        protected void setName​(java.lang.String name)
        Sets the name of this menu action.
      • getName

        protected java.lang.String getName()
        Returns the name of this menu action.
      • setIcon

        public void setIcon​(java.lang.String aName)
        Sets the icon of this menu action by iconname.
      • getIconName

        public java.lang.String getIconName()
        Returns the name of an appropriate icon for this action.
      • getMnemonic

        public char getMnemonic()
        Returns the mnemonic of the menu this menu action is to be associated with. The return value is a key code which should be one of the values specified in KeyEvent.
        Returns:
        the mnemonic, a value of 0 means that no mnemonic is set.
      • getAccelerator

        public javax.swing.KeyStroke getAccelerator()
        Returns the shortcut KeyStroke this menu action is to be invokable with.
        Returns:
        the accelerator or null, if the menu has no accelerator.
      • getToolTip

        public java.lang.String getToolTip()
        Returns the tool tip for this menu action.
        Returns:
        the tool tip String or null, if no tool tip is set.
      • toString

        public java.lang.String toString()
        Returns a String representation of this MenuAction object.
        Overrides:
        toString in class java.lang.Object