String focusTextActionName = "focusTextAction";
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK), focusTextActionName);
getRootPane().getActionMap().put(focusTextActionName, focusTextAction);
// Create a key map for bringing up the text area context menu.
Action textContextAction = new TextContextMenuAction(this);
String textContextActionName = "textContextAction";
this.textArea.getInputMap(JComponent.WHEN_FOCUSED).put(
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_MASK), textContextActionName);
this.textArea.getActionMap().put(textContextActionName, textContextAction);
}