Java Swing Key Action dispatchEvent(final KeyEvent ke, final Component comp)

Here you can find the source of dispatchEvent(final KeyEvent ke, final Component comp)

Description

dispatch Event

License

Open Source License

Declaration

private static void dispatchEvent(final KeyEvent ke, final Component comp) throws Exception 

Method Source Code


//package com.java2s;

import java.awt.Component;

import java.awt.event.KeyEvent;

import javax.swing.SwingUtilities;

public class Main {
    private static void dispatchEvent(final KeyEvent ke, final Component comp) throws Exception {
        if (!SwingUtilities.isEventDispatchThread()) {
            SwingUtilities.invokeAndWait(new Runnable() {
                @Override//from   w w w. j av  a 2s.co m
                public void run() {
                    comp.dispatchEvent(ke);
                }
            });
        } else {
            comp.dispatchEvent(ke);
        }
    }
}

Related

  1. addEscKeyAction(javax.swing.JComponent component, javax.swing.InputMap inputMap, javax.swing.Action action)
  2. addHotKey(int key, JComponent to, String actionName, Action action)
  3. addIcons(Action action, String[][] iconRoles)
  4. addStrokeToName(Action action)
  5. augmentList(Action[] list1, Action[] list2)
  6. escapeKeyAction(JComponent component, javax.swing.AbstractAction abstractAction)
  7. formatKeyStroke(final KeyStroke keyStroke)
  8. getActionID(final Action a)
  9. getActionInstanceName(Action delegate)