void () { myHelp.setText(IdeBundle.message("button.help")); myHelp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onHelp(); } }); getRootPane().registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { onHelp(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW ); getRootPane().registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { onHelp(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW ); }