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

The following examples show how to use javax.swing.SwingUtilities#replaceUIActionMap() . 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 File: CompareResultImages.java    From diirt with 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 File: mxKeyboardHandler.java    From blog-codes with 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
Source File: BasicTaskPaneGroupUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: FileChooserUI.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void installListeners(JFileChooser fc) {
	super.installListeners(fc);

	ActionMap actionMap = getActions();
	SwingUtilities.replaceUIActionMap(fc, actionMap);
}
 
Example 5
Source File: BasicLizziePaneUI.java    From lizzie with GNU General Public License v3.0 4 votes vote down vote up
protected void uninstallKeyboardActions() {
  SwingUtilities.replaceUIActionMap(lizziePane, null);
  SwingUtilities.replaceUIInputMap(
      lizziePane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
}
 
Example 6
Source File: BasicTipOfTheDayUI.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
protected void installKeyboardActions() {
  ActionMap map = getActionMap();
  if (map != null) {
    SwingUtilities.replaceUIActionMap(tipPane, map);
  }
}
 
Example 7
Source File: CloseTabPaneUI.java    From iBioSim with 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 File: CloseTabPaneUI.java    From iBioSim with 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
Source File: BasicTerminalUI.java    From tn5250j with GNU General Public License v2.0 4 votes vote down vote up
protected void uninstallKeyboardActions()
{
  SwingUtilities.replaceUIInputMap(terminal, JComponent.WHEN_FOCUSED, null);
  SwingUtilities.replaceUIActionMap(terminal, null);
}