F1 key usually displays help in any context. Classic Swing action model would require that you set a key listener for all components on the screen. If you use input maps, you can install a central listener for all components inside a frame. This code installs a listener for F1 for all components in top-level JComponent (you cannot use this with a a JFrame, but can attach actions to the content panel of a JFrame - for a full example, see interacting with users):
KeyStroke ks=KeyStroke.getKeyStroke(KeyEvent.VK_F1,0); topComponent.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks,"HELP"); topComponent.getActionMap().put("HELP",new AbstractAction(){ public void actionPerformed(ActionEvent evt){ // do something here, display a dialog or whatever });