Solved

menu shortcuts from swing

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 38
Weekend adv creator 3 64
maven module vs maven project 3 74
junit example issue 2 28
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

726 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