public class TextEditPopupManager extends Object
JTextField textField = new JTextField(20);
TextEditPopupManager.getInstance().registerJTextComponent(textField);
| Modifier and Type | Class and Description |
|---|---|
protected class |
TextEditPopupManager.CaretHandler |
protected class |
TextEditPopupManager.NSelectAllAction |
protected class |
TextEditPopupManager.PopupFocusHandler |
protected class |
TextEditPopupManager.PopupHandler |
protected class |
TextEditPopupManager.RedoAction |
protected class |
TextEditPopupManager.UndoAction |
protected class |
TextEditPopupManager.UndoListener |
| Modifier and Type | Field and Description |
|---|---|
protected HashMap |
actions |
protected CaretListener |
caretHandler |
protected Action |
copy |
static String |
COPY |
protected Action |
cut |
static String |
CUT |
protected JTextComponent |
focusedComp |
protected FocusListener |
focusHandler |
protected Action |
paste |
static String |
PASTE |
protected JPopupMenu |
popup |
protected MouseListener |
popupHandler |
protected Action |
redo |
static String |
REDO |
static String |
SELECT_ALL |
protected Action |
selectAll |
protected List |
textComps |
protected Action |
undo |
static String |
UNDO |
protected UndoManager |
undoer |
protected List |
undoers |
protected TextEditPopupManager.UndoListener |
undoHandler |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearEmptyReferences()
Clears any JTextComponent references from the manager that have been
garbage collected.
|
Action |
getAction(String name) |
protected int |
getIndexOfJTextComponent(JTextComponent tc)
Gets the index of a registered JTextComponent
|
static TextEditPopupManager |
getInstance()
Gets the singleton instance of TextEditPopupManager
|
void |
registerJTextComponent(JTextComponent tc)
Registers a JTextComponent with the manager.
|
void |
registerJTextComponent(JTextComponent tc,
UndoManager um)
Registers a JTextComponent and UndoManager with the manager.
|
void |
unregisterJTextComponent(JTextComponent tc)
Unregisters a JTextComponent from the manager.
|
protected void |
updateActions()
Updates the enabled state of the actions
|
public static final String CUT
public static final String COPY
public static final String PASTE
public static final String SELECT_ALL
public static final String UNDO
public static final String REDO
protected HashMap actions
protected Action cut
protected Action copy
protected Action paste
protected Action selectAll
protected Action undo
protected Action redo
protected List textComps
protected List undoers
protected JTextComponent focusedComp
protected UndoManager undoer
protected FocusListener focusHandler
protected MouseListener popupHandler
protected TextEditPopupManager.UndoListener undoHandler
protected CaretListener caretHandler
protected JPopupMenu popup
public static TextEditPopupManager getInstance()
public void registerJTextComponent(JTextComponent tc) throws IllegalArgumentException
TextEditPopupManager.getInstance().registerJTextComponent(comp);
...
...
TextEditPopupManager.getInstance().unregisterJTextComponent(comp);
comp.setDocument(new PlainDocument());
TextEditPopupManager.getInstance().registerJTextComponent(comp);
tc - The JTextComponent to registerIllegalArgumentException - If the component is null, or already registeredpublic void registerJTextComponent(JTextComponent tc, UndoManager um) throws IllegalArgumentException
tc - The JTextComponent to registerum - The UndoManger to registerIllegalArgumentException - If the component is null, or already registeredpublic void unregisterJTextComponent(JTextComponent tc)
tc - The JTextComponent to unregisterprotected int getIndexOfJTextComponent(JTextComponent tc)
tc - protected void clearEmptyReferences()
protected void updateActions()
Copyright © 2016 Imatia Innovation S.L.. All rights reserved.