Java Swing KeyStroke maybeInstall(InputMap map, String action, KeyStroke stroke)

Here you can find the source of maybeInstall(InputMap map, String action, KeyStroke stroke)

Description

maybe Install

License

Apache License

Declaration

public static void maybeInstall(InputMap map, String action, KeyStroke stroke) 

Method Source Code


//package com.java2s;
/*//  w w w . j ava 2s  .c om
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import javax.swing.*;

public class Main {
    public static void maybeInstall(InputMap map, String action, KeyStroke stroke) {
        if (map.get(stroke) == null) {
            map.put(stroke, action);
        }
    }
}

Related

  1. isKeyStroke(String propClass)
  2. mapInput(JComponent component, int scope, final int keycode, final int modifiers, final AbstractAction action)
  3. mapKeyStrokeAction(JComponent component, String actionMapKey, Action action, KeyStroke keyStroke)
  4. mapKeyStrokeToAction(final JComponent comp, final String ks, final String name, final AbstractAction action)
  5. mapKeyStrokeToButton(final JComponent comp, final String ks, final String name, final AbstractButton button)
  6. refleshAction(JComponent com, KeyStroke keyStroke)
  7. registerAction(JComponent comp, Action action, String key)
  8. registerAction(JComponent component, int condition, KeyStroke key, Action action, String command)
  9. registerAsAction(final KeyStroke keyStroke, final String actionKey, final Runnable action, final JComponent component)