public class XXX { public static void main(String args[]) { JComponent comp = new JTable(); // some panel or table comp.getInputMap().put(KeyStroke.getKeyStroke("F4"), "xxxaction"); comp..getActionMap().put("xxxaction", new XXXAction()); } public class XXXAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { // Something; } } } Action action = component.getActionMap().get("..."); if (action != null) { ActionEvent ae = new ActionEvent(component, ActionEvent.ACTION_PERFORMED, ""); action.actionPerformed( ae ); }