Class RecordableTextAction

    • Constructor Detail

      • RecordableTextAction

        public RecordableTextAction​(String text)
        Constructor.
        Parameters:
        text - The text (name) associated with the action.
      • RecordableTextAction

        public RecordableTextAction​(String text,
                                    Icon icon,
                                    String desc,
                                    Integer mnemonic,
                                    KeyStroke accelerator)
        Constructor.
        Parameters:
        text - The text (name) associated with the action.
        icon - The icon associated with the action.
        desc - The description of the action.
        mnemonic - The mnemonic for the action.
        accelerator - The accelerator key for the action.
    • Method Detail

      • actionPerformedImpl

        public abstract void actionPerformedImpl​(ActionEvent e,
                                                 RTextArea textArea)
        The actual meat of the action. If you wish to subclass this action and modify its behavior, this is the method to override.
        Parameters:
        e - The action being performed.
        textArea - The text area "receiving" the action.
        See Also:
        actionPerformed(java.awt.event.ActionEvent)
      • getDescription

        public String getDescription()
        Returns the description for this action.
        Returns:
        The description.
      • getIcon

        public Icon getIcon()
        Returns the icon for this action.
        Returns:
        The icon.
      • getMacroID

        public abstract String getMacroID()
        Returns the identifier for this macro. This method makes it so that you can create an instance of the RTextAreaEditorKit.CutAction action, for example, rename it to "Remove", and it will still be recorded as a "cut" action. Subclasses should return a unique string from this method; preferably the name of the action.

        If you subclass a RecordableTextAction, you should NOT override this method; if you do, the action may not be properly recorded in a macro.

        Returns:
        The internally-used macro ID.
      • getName

        public String getName()
        Returns the name of this action.
        Returns:
        The name of this action.
        See Also:
        setName(String)
      • isRecordable

        public boolean isRecordable()
        Returns whether or not this action will be recorded and replayed in a macro.
        Returns:
        Whether or not this action will be recorded and replayed.
        See Also:
        setRecordable(boolean)
      • setAccelerator

        public void setAccelerator​(KeyStroke accelerator)
        Sets the accelerator for this action.
        Parameters:
        accelerator - The new accelerator.
        See Also:
        getAccelerator()
      • setMnemonic

        public void setMnemonic​(char mnemonic)
        Sets the mnemonic for this action.
        Parameters:
        mnemonic - The new mnemonic.
        See Also:
        setMnemonic(Integer), getMnemonic()
      • setName

        public void setName​(String name)
        Sets the name of this action.
        Parameters:
        name - The new name.
        See Also:
        getName()
      • setProperties

        public void setProperties​(ResourceBundle msg,
                                  String keyRoot)
        Sets the name, mnemonic, and description of this action.
        Parameters:
        msg - The resource bundle.
        keyRoot - The root of the keys for the properties. ".Name", ".Mnemonic", and ".Desc" will be appended to create the key for each property.
      • setRecordable

        public void setRecordable​(boolean recordable)
        Sets whether or not this action will be recorded and replayed in a macro.
        Parameters:
        recordable - Whether or not this action should be recorded and replayed.
        See Also:
        isRecordable()
      • setShortDescription

        public void setShortDescription​(String shortDesc)
        Sets the short description for this action.
        Parameters:
        shortDesc - The short description for this action.