下面列出了怎么用javax.swing.plaf.ActionMapUIResource的API类实例代码及写法,或者点击链接到github查看源代码。
protected ActionMap createActionMap() {
AbstractAction escAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
getFileChooser().cancelSelection();
}
@Override
public boolean isEnabled(){
return getFileChooser().isEnabled();
}
};
ActionMap map = new ActionMapUIResource();
map.put("approveSelection", getApproveSelectionAction());
map.put("cancelSelection", escAction);
map.put("Go Up", getChangeToParentDirectoryAction());
return map;
}
static ActionMap createMyActionMap() {
ActionMap map = new ActionMapUIResource();
map.put("navigateNext", new NextAction());
map.put("navigatePrevious", new PreviousAction());
map.put("navigateRight", new RightAction());
map.put("navigateLeft", new LeftAction());
map.put("navigateUp", new UpAction());
map.put("navigateDown", new DownAction());
map.put("navigatePageUp", new PageUpAction());
map.put("navigatePageDown", new PageDownAction());
map.put("requestFocus", new RequestFocusAction());
map.put("requestFocusForVisibleComponent", new RequestFocusForVisibleAction());
map.put("setSelectedIndex", new SetSelectedIndexAction());
map.put("scrollTabsForwardAction", new ScrollTabsForwardAction());
map.put("scrollTabsBackwardAction", new ScrollTabsBackwardAction());
return map;
}
protected ActionMap createActions() {
final Action escAction = new AbstractAction() {
private static final long serialVersionUID = -3976059968191425942L;
@Override
public void actionPerformed(ActionEvent e) {
FileChooserUI.this.fileList.stopThumbnailGeneration();
getFileChooser().cancelSelection();
}
@Override
public boolean isEnabled() {
return getFileChooser().isEnabled();
}
};
final ActionMap map = new ActionMapUIResource();
map.put("approveSelection", getApproveSelectionAction());
map.put("cancelSelection", escAction);
return map;
}
private ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
map.put("selectNextColumn", new NavigationAction(1, 0));
map.put("selectPreviousColumn", new NavigationAction(-1, 0));
map.put("selectNextRow", new NavigationAction(0, 1));
map.put("selectPreviousRow", new NavigationAction(0, -1));
map.put("selectNextColumnExtendSelection", new NavigationAction(1, 0, true));
map.put("selectPreviousColumnExtendSelection", new NavigationAction(-1, 0, true));
map.put("selectNextRowExtendSelection", new NavigationAction(0, 1, true));
map.put("selectPreviousRowExtendSelection", new NavigationAction(0, -1, true));
map.put("startEditing", new StartEditingAction());
map.put("cancel", new CancelEditingAction());
map.put("clearCell", new ClearCellAction());
map.put("cutCell", new CutAction());
map.put("copyCell", new CopyAction());
map.put("pasteCell", new PasteAction());
return map;
}
/**
* Creates new form CompareResultImages
*/
public CompareResultImages() {
initComponents();
toReviewList.setModel(new DefaultListModel());
fillList();
setSize(800, 600);
setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
actualImage.setStretch(false);
referenceImage.setStretch(false);
acceptAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));
InputMap keyMap = new ComponentInputMap(acceptButton);
keyMap.put(KeyStroke.getKeyStroke("control D"), "accept");
ActionMap actionMap = new ActionMapUIResource();
actionMap.put("accept", acceptAction);
SwingUtilities.replaceUIActionMap(acceptButton, actionMap);
SwingUtilities.replaceUIInputMap(acceptButton, JComponent.WHEN_IN_FOCUSED_WINDOW, keyMap);
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
/**
* Create the action map for the system menu.
*
* @return the action map.
*/
ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
map.put("showSystemMenu", new ShowSystemMenuAction(true));
map.put("hideSystemMenu", new ShowSystemMenuAction(false));
return map;
}
/**
* Create the action map for the system menu.
*
* @return the action map.
*/
ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
map.put("showSystemMenu", new ShowSystemMenuAction(true));
map.put("hideSystemMenu", new ShowSystemMenuAction(false));
return map;
}
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
// add standard actions
FilePane.addActionsToMap(map, filePane.getActions());
// add synth only actions
map.put("fileNameCompletion", getFileNameCompletionAction());
return map;
}
/**
* Constructs an instance of {@code ActionMap}.
*
* @return an instance of {@code ActionMap}
*/
protected ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
FilePane.addActionsToMap(map, filePane.getActions());
return map;
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}
/**
* Installs the maps on the root pane of the originating component of
* the first popup panel of the specified sequence to trace the ESC key
* and dismiss the shown popup panels.
*
* @param shownPath Popup panel sequence.
*/
private void traceRootPane(List<PopupPanelManager.PopupInfo> shownPath) {
JComponent originator = shownPath.get(0).getPopupOriginator();
this.tracedRootPane = SwingUtilities.getRootPane(originator);
if (this.tracedRootPane != null) {
newInputMap = new ComponentInputMapUIResource(tracedRootPane);
newInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
"hidePopupPanel");
newActionMap = new ActionMapUIResource();
newActionMap.put("hidePopupPanel", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
// Hide the last sequence popup for every ESC keystroke.
// There is special case - if the keytips are shown
// for the *second* panel of the app menu popup panel,
// do not dismiss the popup
List<PopupPanelManager.PopupInfo> popups = PopupPanelManager
.defaultManager().getShownPath();
if (popups.size() > 0) {
PopupPanelManager.PopupInfo lastPopup = popups
.get(popups.size() - 1);
if (lastPopup.getPopupPanel() instanceof JRibbonApplicationMenuPopupPanel) {
JRibbonApplicationMenuPopupPanel appMenuPopupPanel =
(JRibbonApplicationMenuPopupPanel) lastPopup
.getPopupPanel();
KeyTipManager.KeyTipChain currentlyShownKeyTipChain = KeyTipManager
.defaultManager().getCurrentlyShownKeyTipChain();
if ((currentlyShownKeyTipChain != null)
&& (currentlyShownKeyTipChain.chainParentComponent == appMenuPopupPanel
.getPanelLevel2()))
return;
}
}
PopupPanelManager.defaultManager().hideLastPopup();
}
});
addUIInputMap(tracedRootPane, newInputMap);
addUIActionMap(tracedRootPane, newActionMap);
}
}
@Override
protected ActionMap createActionMap() {
return new ActionMapUIResource();
}