Java Code Examples for javax.swing.SwingUtilities#replaceUIActionMap()

The following examples show how to use javax.swing.SwingUtilities#replaceUIActionMap() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: diirt   File: CompareResultImages.java    License: MIT License 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source Project: blog-codes   File: mxKeyboardHandler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invoked as part from the boilerplate install block.
 */
protected void installKeyboardActions(mxGraphComponent graphComponent)
{
	InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
	SwingUtilities.replaceUIInputMap(graphComponent,
			JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);

	inputMap = getInputMap(JComponent.WHEN_FOCUSED);
	SwingUtilities.replaceUIInputMap(graphComponent,
			JComponent.WHEN_FOCUSED, inputMap);
	SwingUtilities.replaceUIActionMap(graphComponent, createActionMap());
}
 
Example 3
protected void installKeyboardActions() {
  InputMap inputMap = (InputMap)UIManager.get("TaskPaneGroup.focusInputMap");
  if (inputMap != null) {
    SwingUtilities.replaceUIInputMap(
      group,
      JComponent.WHEN_FOCUSED,
      inputMap);
  }

  ActionMap map = getActionMap();
  if (map != null) {
    SwingUtilities.replaceUIActionMap(group, map);
  }
}
 
Example 4
@Override
protected void installListeners(JFileChooser fc) {
	super.installListeners(fc);

	ActionMap actionMap = getActions();
	SwingUtilities.replaceUIActionMap(fc, actionMap);
}
 
Example 5
protected void uninstallKeyboardActions() {
  SwingUtilities.replaceUIActionMap(lizziePane, null);
  SwingUtilities.replaceUIInputMap(
      lizziePane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
}
 
Example 6
protected void installKeyboardActions() {
  ActionMap map = getActionMap();
  if (map != null) {
    SwingUtilities.replaceUIActionMap(tipPane, map);
  }
}
 
Example 7
Source Project: iBioSim   File: CloseTabPaneUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void installKeyboardActions() {
	InputMap km = getMyInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, km);
	km = getMyInputMap(JComponent.WHEN_FOCUSED);
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, km);

	ActionMap am = createMyActionMap();

	SwingUtilities.replaceUIActionMap(tabPane, am);

	tabScroller.scrollForwardButton.setAction(am.get("scrollTabsForwardAction"));
	tabScroller.scrollBackwardButton.setAction(am.get("scrollTabsBackwardAction"));

}
 
Example 8
Source Project: iBioSim   File: CloseTabPaneUI.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void uninstallKeyboardActions() {
	SwingUtilities.replaceUIActionMap(tabPane, null);
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, null);
}
 
Example 9
protected void uninstallKeyboardActions()
{
  SwingUtilities.replaceUIInputMap(terminal, JComponent.WHEN_FOCUSED, null);
  SwingUtilities.replaceUIActionMap(terminal, null);
}