Solved

menu shortcuts from swing

Posted on 2001-09-17
4
183 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JAVA part two 5 57
Non-recursive backtracking, using a stack 1 101
thymeleaf natural templating vs JSP 2 67
HSSFWorkbook cannot be resolved error 10 50
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

911 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

22 Experts available now in Live!

Get 1:1 Help Now