javax.swing

Interface Action

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static String ACCELERATOR_KEY
      The key used for storing a KeyStroke to be used as the accelerator for the action.
      static String ACTION_COMMAND_KEY
      The key used to determine the command String for the ActionEvent that will be created when an Action is going to be notified as the result of residing in a Keymap associated with a JComponent.
      static String DEFAULT
      Not currently used.
      static String DISPLAYED_MNEMONIC_INDEX_KEY
      The key used for storing an Integer that corresponds to the index in the text (identified by the NAME property) that the decoration for a mnemonic should be rendered at.
      static String LARGE_ICON_KEY
      The key used for storing an Icon.
      static String LONG_DESCRIPTION
      The key used for storing a longer String description for the action, could be used for context-sensitive help.
      static String MNEMONIC_KEY
      The key used for storing an Integer that corresponds to one of the KeyEvent key codes.
      static String NAME
      The key used for storing the String name for the action, used for a menu or button.
      static String SELECTED_KEY
      The key used for storing a Boolean that corresponds to the selected state.
      static String SHORT_DESCRIPTION
      The key used for storing a short String description for the action, used for tooltip text.
      static String SMALL_ICON
      The key used for storing a small Icon, such as ImageIcon.

        

    • Field Detail

      • NAME

        static final String NAME
        The key used for storing the String name for the action, used for a menu or button.
        See Also:
        Constant Field Values
      • SHORT_DESCRIPTION

        static final String SHORT_DESCRIPTION
        The key used for storing a short String description for the action, used for tooltip text.
        See Also:
        Constant Field Values
      • LONG_DESCRIPTION

        static final String LONG_DESCRIPTION
        The key used for storing a longer String description for the action, could be used for context-sensitive help.
        See Also:
        Constant Field Values
      • SMALL_ICON

        static final String SMALL_ICON
        The key used for storing a small Icon, such as ImageIcon. This is typically used with menus such as JMenuItem.

        If the same Action is used with menus and buttons you'll typically specify both a SMALL_ICON and a LARGE_ICON_KEY. The menu will use the SMALL_ICON and the button will use the LARGE_ICON_KEY.

        See Also:
        Constant Field Values
      • ACTION_COMMAND_KEY

        static final String ACTION_COMMAND_KEY
        The key used to determine the command String for the ActionEvent that will be created when an Action is going to be notified as the result of residing in a Keymap associated with a JComponent.
        See Also:
        Constant Field Values
      • ACCELERATOR_KEY

        static final String ACCELERATOR_KEY
        The key used for storing a KeyStroke to be used as the accelerator for the action.
        Since:
        1.3
        See Also:
        Constant Field Values
      • MNEMONIC_KEY

        static final String MNEMONIC_KEY
        The key used for storing an Integer that corresponds to one of the KeyEvent key codes. The value is commonly used to specify a mnemonic. For example: myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A) sets the mnemonic of myAction to 'a', while myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.getExtendedKeyCodeForChar('?')) sets the mnemonic of myAction to Cyrillic letter "Ef".
        Since:
        1.3
        See Also:
        Constant Field Values
      • SELECTED_KEY

        static final String SELECTED_KEY
        The key used for storing a Boolean that corresponds to the selected state. This is typically used only for components that have a meaningful selection state. For example, JRadioButton and JCheckBox make use of this but instances of JMenu don't.

        This property differs from the others in that it is both read by the component and set by the component. For example, if an Action is attached to a JCheckBox the selected state of the JCheckBox will be set from that of the Action. If the user clicks on the JCheckBox the selected state of the JCheckBox and the Action will both be updated.

        Note: the value of this field is prefixed with 'Swing' to avoid possible collisions with existing Actions.

        Since:
        1.6
        See Also:
        Constant Field Values
      • DISPLAYED_MNEMONIC_INDEX_KEY

        static final String DISPLAYED_MNEMONIC_INDEX_KEY
        The key used for storing an Integer that corresponds to the index in the text (identified by the NAME property) that the decoration for a mnemonic should be rendered at. If the value of this property is greater than or equal to the length of the text, it will treated as -1.

        Note: the value of this field is prefixed with 'Swing' to avoid possible collisions with existing Actions.

        Since:
        1.6
        See Also:
        AbstractButton.setDisplayedMnemonicIndex(int), Constant Field Values
      • LARGE_ICON_KEY

        static final String LARGE_ICON_KEY
        The key used for storing an Icon. This is typically used by buttons, such as JButton and JToggleButton.

        If the same Action is used with menus and buttons you'll typically specify both a SMALL_ICON and a LARGE_ICON_KEY. The menu will use the SMALL_ICON and the button the LARGE_ICON_KEY.

        Note: the value of this field is prefixed with 'Swing' to avoid possible collisions with existing Actions.

        Since:
        1.6
        See Also:
        Constant Field Values
    • Method Detail

      • putValue

        void putValue(String key,
                    Object value)
        Sets one of this object's properties using the associated key. If the value has changed, a PropertyChangeEvent is sent to listeners.
        Parameters:
        key - a String containing the key
        value - an Object value
      • setEnabled

        void setEnabled(boolean b)
        Sets the enabled state of the Action. When enabled, any component associated with this object is active and able to fire this object's actionPerformed method. If the value has changed, a PropertyChangeEvent is sent to listeners.
        Parameters:
        b - true to enable this Action, false to disable it
      • isEnabled

        boolean isEnabled()
        Returns the enabled state of the Action. When enabled, any component associated with this object is active and able to fire this object's actionPerformed method.
        Returns:
        true if this Action is enabled
      • addPropertyChangeListener

        void addPropertyChangeListener(PropertyChangeListener listener)
        Adds a PropertyChange listener. Containers and attached components use these methods to register interest in this Action object. When its enabled state or other property changes, the registered listeners are informed of the change.
        Parameters:
        listener - a PropertyChangeListener object

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

 

Document créé le 29/08/2006, dernière modification le 29/10/2018
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/action.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, Action

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.