Solved

menu shortcuts from swing

Posted on 2001-09-17
4
184 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:CactusCowboy
  • 2
4 Comments
 

Accepted Solution

by:
EWilliams earned 50 total points
ID: 6488179
0
 
LVL 92

Expert Comment

by:objects
ID: 6489021
Try setAccelerator() in JMenuItem.
0
 
LVL 92

Expert Comment

by:objects
ID: 6489859
Can never understand why people give comments a C grade without asking for clarification or more information.
0
 

Author Comment

by:CactusCowboy
ID: 6490260
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
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 42
session migration servlets 2 42
java jdbc batch example 8 41
hibernate example for saving data 19 54
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question