Java Swing KeyStroke synchronizeKeyboardActions( JComponent sourceComponent, JComponent targetComponent, KeyStroke[] keyStrokes, int condition)

Here you can find the source of synchronizeKeyboardActions( JComponent sourceComponent, JComponent targetComponent, KeyStroke[] keyStrokes, int condition)

Description

synchronize Keyboard Actions

License

Open Source License

Declaration

public static void synchronizeKeyboardActions(
                JComponent sourceComponent, JComponent targetComponent,
                KeyStroke[] keyStrokes, int condition)
        

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.event.ActionListener;

import javax.swing.JComponent;

import javax.swing.KeyStroke;

public class Main {
    public static void synchronizeKeyboardActions(
            JComponent sourceComponent, JComponent targetComponent,
            KeyStroke[] keyStrokes, int condition)
    /*      */{/*from   w  w  w  .java  2  s  .  co  m*/
        /* 3517 */for (KeyStroke keyStroke : keyStrokes) {
            /* 3518 */ActionListener actionListener = sourceComponent
                    .getActionForKeyStroke(keyStroke);
            /* 3519 */if (actionListener != null)
                /* 3520 */targetComponent.registerKeyboardAction(
                        actionListener, keyStroke, condition);
            /*      */}
        /*      */}
}

Related

  1. setKeyStroke(JComponent component, KeyStroke keyStroke, Action action)
  2. setUpCycle(JComponent comp, int key)
  3. stringToKeyStroke(String s)
  4. strokeToPrefs(KeyStroke prefsStroke)
  5. synchronizeKeyboardActions( JComponent sourceComponent, JComponent targetComponent, KeyStroke[] keyStrokes, int condition)
  6. unregisterKeyBoardAction(JComponent comp, Action action)
  7. withKeyStroke(M jmi, KeyStroke ks)