- Direct Known Subclasses:
public abstract class TextAction extends AbstractAction
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the
Constructors Constructor Description
String name)(Creates a new JTextAction object.
Modifier and Type Method Description
Action list1, Action list2)(Takes one list of commands and augments it with another list of commands.
()Fetches the text component that currently has focus.
ActionEvent e)(Determines the component to use for the action.
Methods declared in class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
Methods declared in class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
TextActionpublic TextAction(String name)Creates a new JTextAction object.
name- the name of the action
getTextComponentDetermines the component to use for the action. This if fetched from the source of the ActionEvent if it's not null and can be narrowed. Otherwise, the last focused component is used.
e- the ActionEvent
- the component
augmentListTakes one list of commands and augments it with another list of commands. The second list takes precedence over the first list; that is, when both lists contain a command with the same name, the command from the second list is used.
list1- the first list, may be empty but not
list2- the second list, may be empty but not
- the augmented list
getFocusedComponentprotected final JTextComponent getFocusedComponent()Fetches the text component that currently has focus. This allows actions to be shared across text components which is useful for key-bindings where a large set of actions are defined, but generally used the same way across many different components.
- the component