|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.atlanticbb.tantlinger.ui.text.TextEditPopupManager
public class TextEditPopupManager
Manages an application-wide popup menu for JTextComponents. Any JTextComponent registered with the manager will have a right-click invokable popup menu, which provides options to undo, redo, cut, copy, paste, and select-all. The popup manager is a singleton and must be retrieved with the getInstance() method:
JTextField textField = new JTextField(20);
TextEditPopupManager.getInstance().registerJTextComponent(textField);
Field Summary | |
---|---|
static java.lang.String |
COPY
|
static java.lang.String |
CUT
|
static java.lang.String |
PASTE
|
static java.lang.String |
REDO
|
static java.lang.String |
SELECT_ALL
|
static java.lang.String |
UNDO
|
Method Summary | |
---|---|
javax.swing.Action |
getAction(java.lang.String name)
|
protected int |
getIndexOfJTextComponent(javax.swing.text.JTextComponent tc)
Gets the index of a registered JTextComponent |
static TextEditPopupManager |
getInstance()
Gets the singleton instance of TextEditPopupManager |
void |
registerJTextComponent(javax.swing.text.JTextComponent tc)
Registers a JTextComponent with the manager. |
void |
registerJTextComponent(javax.swing.text.JTextComponent tc,
javax.swing.undo.UndoManager um)
Registers a JTextComponent and UndoManager with the manager. |
void |
unregisterJTextComponent(javax.swing.text.JTextComponent tc)
Unregisters a JTextComponent from the manager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CUT
public static final java.lang.String COPY
public static final java.lang.String PASTE
public static final java.lang.String SELECT_ALL
public static final java.lang.String UNDO
public static final java.lang.String REDO
Method Detail |
---|
public static TextEditPopupManager getInstance()
public javax.swing.Action getAction(java.lang.String name)
public void registerJTextComponent(javax.swing.text.JTextComponent tc) throws java.lang.IllegalArgumentException
TextEditPopupManager.getInstance().registerJTextComponent(comp);
...
...
TextEditPopupManager.getInstance().unregisterJTextComponent(comp);
comp.setDocument(new PlainDocument());
TextEditPopupManager.getInstance().registerJTextComponent(comp);
tc
- The JTextComponent to register
java.lang.IllegalArgumentException
- If the component is null, or already
registeredpublic void registerJTextComponent(javax.swing.text.JTextComponent tc, javax.swing.undo.UndoManager um) throws java.lang.IllegalArgumentException
tc
- The JTextComponent to registerum
- The UndoManger to register
java.lang.IllegalArgumentException
- If the component is null, or already
registeredpublic void unregisterJTextComponent(javax.swing.text.JTextComponent tc)
tc
- The JTextComponent to unregisterprotected int getIndexOfJTextComponent(javax.swing.text.JTextComponent tc)
tc
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |