Java Swing ActionMap addEnterAction(JComponent c, Action a)

Here you can find the source of addEnterAction(JComponent c, Action a)

Description

add Enter Action

License

GNU General Public License

Declaration

public static void addEnterAction(JComponent c, Action a) 

Method Source Code

//package com.java2s;
// License: GPL. For details, see LICENSE file.

import java.awt.event.KeyEvent;
import javax.swing.Action;

import javax.swing.JComponent;
import javax.swing.KeyStroke;

public class Main {
    public static void addEnterAction(JComponent c, Action a) {
        c.getActionMap().put("enter", a);
        c.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
    }/*from w w  w .j  av a2 s. com*/
}

Related

  1. addAction(JComponent component, String kstr, AbstractAction action)
  2. addComponentAction(final JComponent component, final Action action)
  3. addEnterAction(JComponent comp, Action action)
  4. addFieldsValidateAction(Action action, JComponent... components)
  5. addFieldValidateAction(JComponent field, Action action)
  6. attachAccelerator(Action action, JComponent component)