Solved

menu shortcuts from swing

Posted on 2001-09-17
4
182 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
Comment Utility
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
Try setAccelerator() in JMenuItem.
0
 
LVL 92

Expert Comment

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

Author Comment

by:CactusCowboy
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now