Use setMnemonic(KeyEvent.VK_F);
I recommend you to read this about JMenus : Howto use Menus
Here is an extract of this article :
Menus support two kinds of keyboard alternatives: mnemonics and
accelerators. Mnemonics offer a way to use the keyboard to navigate
the menu hierarchy, increasing the accessibility of programs.
Accelerators, on the other hand, offer keyboard shortcuts to bypass
navigating the menu hierarchy. Mnemonics are for all users;
accelerators are for power users.
A mnemonic is a key that makes an already visible menu item be chosen.
For example, in MenuDemo the first menu has the mnemonic A, and its
second menu item has the mnemonic B. This means that, when you run
MenuDemo with the Java look and feel, pressing the Alt and A keys
makes the first menu appear. While the first menu is visible, pressing
the B key (with or without Alt) makes the second menu item be chosen.
A menu item generally displays its mnemonic by underlining the first
occurrence of the mnemonic character in the menu item's text, as the
following snapshot shows. B is the mnemonic character for this menu
item
You can specify a mnemonic either when constructing the menu item or
with the setMnemonic method. Here are examples of setting mnemonics
and accelerators:
//Setting the mnemonic when constructing a menu item:
menuItem = new JMenuItem("A text-only menu item",
KeyEvent.VK_T);
//Setting the mnemonic after creation time:
menuItem.setMnemonic(KeyEvent.VK_T);
As you can see, you set a mnemonic by specifying the KeyEvent constant
corresponding to the key the user should press.