Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement