예제 #1
0
  public static ComponentInputMap makeComponentInputMap(
      final JComponent comp, final Object[] keys) {
    ComponentInputMapUIResource result = new ComponentInputMapUIResource(comp);
    loadKeyBindings(result, keys);

    return result;
  }
  /*
   * Load key bindings from UIDefaults to InputMap. This occurs
   * when the default button is assigned.
   */
  private void loadDefaultButtonKeyBindings(final JComponent root) {
    Object[] bindings = ((Object[]) UIManager.get("RootPane.defaultButtonWindowKeyBindings"));

    if (bindings != null) {
      InputMap map =
          SwingUtilities.getUIInputMap(root, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
      LookAndFeel.loadKeyBindings(map, bindings);
    }
  }
예제 #3
0
  public static InputMap makeInputMap(final Object[] bindings) {
    InputMapUIResource result = new InputMapUIResource();
    loadKeyBindings(result, bindings);

    return result;
  }