LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2004, 02:39 PM   #1
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
Java Menu Question


Hi all,


Is there any way to set a keyboard mnemonic for a MenuItem. I've seen dozens of examples on how to set them up using a JMenuItem.

Code:
myJmenuItem.setMnemonic(someKeyboardShortcut);
setMnemoic is inherited from AbstractButton which is part of javax.swing.
I'm hoping there is an equivalent way to do this just using java.awt.

Am I just missing something all together??


Thanks
 
Old 01-26-2004, 02:49 PM   #2
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Why are you trying to do this just with awt?
 
Old 01-26-2004, 03:27 PM   #3
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Original Poster
Rep: Reputation: 30
Well... I didn't know you could change the look and feel of a swing application until about 20 minutes ago. <-- Idiot.

I'm writing something for the local school district and they thought the java look and feel was ugly. They wanted something that looked like the rest of their applications.
 
Old 02-01-2004, 08:48 PM   #4
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
Use swing instead of AWT... If you look at the SwingUtilities class there is a method in there to set the system default look and feel (which on recent versions of windows is fairly believable, though not perfect... better than AWT anyway).

HTH

B.
 
Old 02-16-2004, 04:45 PM   #5
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
Oh right and the way to do the keyboard shortcut is to have a method somewhere, which the event handlers for both the keyboard (KeyListener) and JMenuItem call. You should attach the KeyListener to something high up like a JPanel or even the JFrame. (ie NOT the JMenuItem).

B.
 
Old 02-17-2004, 09:57 AM   #6
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Java default look and feel will changed in J2sdk1.5 which is still a beta version. I haven't tried it out though. I hope that will be the prettier one.
 
Old 02-17-2004, 10:05 AM   #7
jfabiani
Member
 
Registered: Apr 2003
Location: Woodland, CA
Distribution: RH 8.0
Posts: 33

Rep: Reputation: 15
Take a look at www.jgoodies.com - they have a free l&f lib that is great. If you have some money they also have a complete lib that will help a lot with l&f issues....

John Fabiani
 
Old 02-18-2004, 12:26 AM   #8
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Thanks for the heads up.

Last edited by coolman0stress; 02-18-2004 at 12:29 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java: floating menu ashirazi Programming 4 06-16-2005 08:51 PM
Question about drop down menu and Java Hockeyfan Programming 1 06-03-2005 11:11 PM
Java Menu help webwolf70 Programming 5 10-30-2004 02:33 AM
java-gnome Menu click event(nothing happens) rmanocha Programming 0 09-18-2004 03:15 PM
java menu inside frame toovato Programming 1 11-05-2003 06:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration