List of utility methods to do JTextComponent Action
Action | getAction(JTextComponent component, String actionName) Search the given text component's list of actions for an action with the given name. for (Action a : component.getActions()) { if (actionName.equals(a.getValue(Action.NAME))) { return a; return null; |
T | getAction(JTextComponent target, Class Searches all actions of a JTextComponent for ab action of the given class and returns the first one that matches that class, or null if no Action is found for (Object k : target.getActionMap().allKeys()) { Action a = target.getActionMap().get(k); if (aClass.isInstance(a)) { @SuppressWarnings("unchecked") T t = (T) a; return t; return null; |
void | setHistoryActions(JTextComponent textComponent) set History Actions Document doc = textComponent.getDocument(); UndoManager undo = new UndoManager(); doc.addUndoableEditListener(new UndoableEditListener() { @Override public void undoableEditHappened(UndoableEditEvent evt) { undo.addEdit(evt.getEdit()); }); ... |