?
Solved

menu shortcuts from swing

Posted on 2001-09-17
4
Medium Priority
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Accepted Solution

by:
EWilliams earned 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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:
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

764 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