public void loadBindingMap(InputMap im, ActionMap am) { results.append("Bound Actions\n"); String unboundActions = ""; String unboundInputKeys = ""; Hashtable mi = buildReverseMap(im); Object[] k = am.allKeys(); if (k != null) { for (int i = 0; i < k.length; i++) { if (mi.containsKey(k[i])) { results.append(" " + getActionName(k[i])); results.append(";" + mi.get(k[i]) + "\n"); } else { unboundActions += (" " + getActionName(k[i]) + "\n"); } } results.append("\nUnbound Actions\n\n"); results.append(unboundActions); } results.append("\nUnbound InputMap Entries\n"); k = im.allKeys(); if (k != null) { for (int i = 0; i < k.length; i++) { KeyStroke key = (KeyStroke) k[i]; Object actionKey = im.get(key); if (am.get(actionKey) == null) { results.append(" " + im.get((KeyStroke) k[i]) + ": " + k[i] + "\n"); } } } }
protected void installKeyboardActions() { super.installKeyboardActions(); ActionMap map = SwingUtilities.getUIActionMap(getComponent()); if (map != null && map.get(DefaultEditorKit.selectWordAction) != null) { Action a = map.get(DefaultEditorKit.selectLineAction); if (a != null) { map.put(DefaultEditorKit.selectWordAction, a); } } }
ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); Action refreshAction = new UIAction(FilePane.ACTION_REFRESH) { public void actionPerformed(ActionEvent evt) { getFileChooser().rescanCurrentDirectory(); } }; map.put(FilePane.ACTION_APPROVE_SELECTION, getApproveSelectionAction()); map.put(FilePane.ACTION_CANCEL, getCancelSelectionAction()); map.put(FilePane.ACTION_REFRESH, refreshAction); map.put(FilePane.ACTION_CHANGE_TO_PARENT_DIRECTORY, getChangeToParentDirectoryAction()); return map; }
public void loadActionMap(ActionMap am, String indent) { Object[] k = am.allKeys(); if (k == null) { results.append(indent + "No ActionMap defined\n"); } else { results.append(indent + "\nActionMap (" + k.length + " local keys)\n"); } if (k != null) { for (int i = 0; i < k.length; i++) { results.append(indent + " Action: " + k[i] + "\n"); } } }
private ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); map.put("selectNextColumn", new NavigationalAction(1, 0, false, false, false)); map.put("selectPreviousColumn", new NavigationalAction(-1, 0, false, false, false)); map.put("selectNextRow", new NavigationalAction(0, 1, false, false, false)); map.put("selectPreviousRow", new NavigationalAction(0, -1, false, false, false)); map.put("selectNextColumnExtendSelection", new NavigationalAction(1, 0, false, true, false)); map.put( "selectPreviousColumnExtendSelection", new NavigationalAction(-1, 0, false, true, false)); map.put("selectNextRowExtendSelection", new NavigationalAction(0, 1, false, true, false)); map.put("selectPreviousRowExtendSelection", new NavigationalAction(0, -1, false, true, false)); map.put("scrollUpChangeSelection", new PagingAction(false, false, true, false)); map.put("scrollDownChangeSelection", new PagingAction(false, true, true, false)); map.put("selectFirstColumn", new PagingAction(false, false, false, true)); map.put("selectLastColumn", new PagingAction(false, true, false, false)); map.put("scrollUpExtendSelection", new PagingAction(true, false, true, false)); map.put("scrollDownExtendSelection", new PagingAction(true, true, true, false)); map.put("selectFirstColumnExtendSelection", new PagingAction(true, false, false, true)); map.put("selectLastColumnExtendSelection", new PagingAction(true, true, false, false)); map.put("selectFirstRow", new PagingAction(false, false, true, true)); map.put("selectLastRow", new PagingAction(false, true, true, true)); map.put("selectFirstRowExtendSelection", new PagingAction(true, false, true, true)); map.put("selectLastRowExtendSelection", new PagingAction(true, true, true, true)); map.put("selectNextColumnCell", new NavigationalAction(1, 0, true, false, true)); map.put("selectPreviousColumnCell", new NavigationalAction(-1, 0, true, false, true)); map.put("selectNextRowCell", new NavigationalAction(0, 1, true, false, true)); map.put("selectPreviousRowCell", new NavigationalAction(0, -1, true, false, true)); map.put("selectAll", new SelectAllAction()); map.put("cancel", new CancelEditingAction()); map.put("startEditing", new StartEditingAction()); map.put("scrollLeftChangeSelection", new PagingAction(false, false, false, false)); map.put("scrollRightChangeSelection", new PagingAction(false, true, false, false)); map.put("scrollLeftExtendSelection", new PagingAction(true, false, false, false)); map.put("scrollRightExtendSelection", new PagingAction(true, true, false, false)); return map; }