File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes set F11 key as mnemonic for jButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "set F11 key as mnemonic for jButton" Watch "set F11 key as mnemonic for jButton" New topic

set F11 key as mnemonic for jButton

Carl John
Ranch Hand

Joined: Jun 14, 2010
Posts: 47

It is possible to set F11 key as Jbutton mnemonic ...? If so ,Please guide me..!

Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

As a mnemonic, no. Mnemonics are keys that will be activated when you press Alt. For instance, 'X' would be the mnemonic if Alt+X would activate the button.

What you want is what is an accelerator in menu items. This doesn't exist for other* buttons, but you can use key bindings instead. Check out the Java tutorial for more information.

* JMenuItem extends AbstractButton so technically it's a button

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: set F11 key as mnemonic for jButton
Similar Threads
Underline first character of a JButton?
Hot keys!
shortcut key for label
Mnemonic question