Your Ad Here

Posted By

mehlam2 on 10/25/07


Tagged

java key bindings


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bobmin


Assigning key bindings and setting them


 / Published in: Java
 

  1. public void setBindings(JFrame mainFrame){
  2. JComponent c = mainFrame.getRootPane();
  3. c.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_O , InputEvent.CTRL_DOWN_MASK), "open project");
  4. c.getActionMap().put("open project", new OpenProjectAction());
  5. }

Report this snippet  

You need to login to post a comment.