CactusCowboy
asked on
menu shortcuts from swing
Hi Everyone,
I am converting a GUI code from AWT to Swing. In AWT I could use the MenuShortcut class to
provide hot keys for MenuItems.
e.g. new MenuItem ("Exit",new MenuShortcut(81))
allows the user to exit using Ctrl+Q
JMenuItem does not seem to support this. Is there a way to implement menu shortcuts in Swing or do I have to provide my own KeyListener for this ?
Thanks,
Mike
I am converting a GUI code from AWT to Swing. In AWT I could use the MenuShortcut class to
provide hot keys for MenuItems.
e.g. new MenuItem ("Exit",new MenuShortcut(81))
allows the user to exit using Ctrl+Q
JMenuItem does not seem to support this. Is there a way to implement menu shortcuts in Swing or do I have to provide my own KeyListener for this ?
Thanks,
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try setAccelerator() in JMenuItem.
Can never understand why people give comments a C grade without asking for clarification or more information.
ASKER
Hi 'objects' : C grade means "average", not bad. I just didn't reckon that simply pointing to the right place in the documentation (even though that was the best way of answering the question) justified a higher grade than "average" ... but then I'm new to Experts Exchange.
Thanks for your interest in my question, I'll try to make future questions more challenging so that I feel I can give higher grades :-)
Mike aka CactusCowboy
Thanks for your interest in my question, I'll try to make future questions more challenging so that I feel I can give higher grades :-)
Mike aka CactusCowboy