Results 1 to 2 of 2
- 12-20-2008, 12:08 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 63
- Rep Power
- 0
Press F1 key to open Help Contents
Hi, I'm sure there is a simple way to do this. I have a menu, and by pressing CTRL + A, for example, it launches that menu. Here's the code:
contents.setAccelerator(KeyStroke.getKeyStroke(Key Event.VK_A,
ActionEvent.CTRL_MASK));
How would I do the same thing by pressing the F1 key, and is the solution the same for all the F keys?
Help is greatly appreciated.
-
I think that this can best be done using key binding. There's a decent tutorial on this on the Sun Swing tutorial site, here: How to Use Key Bindings (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Other Swing Features)
Similar Threads
-
How to open a file without erasing its contents?
By spmchugh82 in forum New To JavaReplies: 2Last Post: 12-17-2008, 02:52 AM -
press any key to continue
By dotnet007 in forum New To JavaReplies: 3Last Post: 05-11-2008, 06:19 AM -
Reading Char without needing to press enter
By x0psci in forum New To JavaReplies: 0Last Post: 11-23-2007, 05:28 PM -
Press any key to continue/press enter
By JT4NK3D in forum New To JavaReplies: 1Last Post: 11-17-2007, 10:27 PM
Bookmarks