Assigning key bindings and setting them


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.