public final class EditorRegistry extends Object
JTextComponents in most-recently-used order.
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPONENT_REMOVED_PROPERTY
Fired when a component (returned previously from
componentList())
is removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected). |
static String |
FOCUS_GAINED_PROPERTY
Fired when focus was delivered to a registered text component.
|
static String |
FOCUS_LOST_PROPERTY
Fired when a registered focused component has lost the focus.
|
static String |
FOCUSED_DOCUMENT_PROPERTY
Fired when document property of the focused component changes
i.e.
|
static String |
LAST_FOCUSED_REMOVED_PROPERTY
Fired when the last focused component (returned previously from
lastFocusedComponent())
was removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected). |
| Modifier and Type | Method and Description |
|---|---|
static void |
addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener for either of the following properties:
FOCUS_GAINED_PROPERTY
FOCUS_LOST_PROPERTY
FOCUSED_DOCUMENT_PROPERTY
. |
static List<? extends JTextComponent> |
componentList()
Get list of all components present in the registry starting with the most active
and ending with least active component.
|
static JTextComponent |
focusedComponent()
Return the last focused component if it currently has a focus
or return null if none of the registered components currently have the focus.
|
static JTextComponent |
lastFocusedComponent()
Return last focused text component (from the ones included in the registry).
|
static void |
removePropertyChangeListener(PropertyChangeListener l) |
public static final String FOCUS_GAINED_PROPERTY
PropertyChangeEvent.getOldValue() will be a component
losing the focus FocusEvent.getOppositeComponent().
The PropertyChangeEvent.getNewValue() will be the text component gaining the focus.public static final String FOCUS_LOST_PROPERTY
PropertyChangeEvent.getOldValue() will be the text component
losing the focus and the PropertyChangeEvent.getNewValue()
will be the component gaining the focus FocusEvent.getOppositeComponent().public static final String FOCUSED_DOCUMENT_PROPERTY
JTextComponent.setDocument(Document).
PropertyChangeEvent.getOldValue() will be the original document
of the focused text component and the PropertyChangeEvent.getNewValue()
will be the new document set to the focused text component.public static final String COMPONENT_REMOVED_PROPERTY
componentList())
is removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected).
componentList()
or lastFocusedComponent().
PropertyChangeEvent.getOldValue() will be the removed
component.
PropertyChangeEvent.getNewValue() returns nullpublic static final String LAST_FOCUSED_REMOVED_PROPERTY
lastFocusedComponent())
was removed from component hierarchy (so it's likely that the component will be released completely
and garbage-collected).
componentList()
or lastFocusedComponent().
PropertyChangeEvent.getOldValue() will be the removed
last focused component and the PropertyChangeEvent.getNewValue()
will be the component that would currently be returned from lastFocusedComponent().
PropertyChangeEvent.getNewValue() returns null
then there are no longer any registered components
(componentList() would return empty list). If the client
holds per-last-focused-component data it should clear them.public static JTextComponent lastFocusedComponent()
public static JTextComponent focusedComponent()
public static List<? extends JTextComponent> componentList()
public static void addPropertyChangeListener(PropertyChangeListener l)
l - non-null listener to add.public static void removePropertyChangeListener(PropertyChangeListener l)
Built on May 21 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.