File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Mnemonics problem on Mac OS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Mnemonics problem on Mac OS" Watch "Mnemonics problem on Mac OS" New topic

Mnemonics problem on Mac OS

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi all,

I have a problem with the keyboard shortcuts (mnemonics) - when the cursor is in a text field after entering e.g. the database location, when I now click alt + the corresponding key for a button, the character assigned to this combination is first inserted to the text field and then the button's listener is called, resulting in an invalid field content.

I started development on linux first and only recently switched to Mac OS. If I remember correctly, I did not have this problem on linux.

Does anyone have the same problem and perhaps have an idea what I can do?

Thanks a lot in advance,
K. Tsang

Joined: Sep 13, 2007
Posts: 3130

You may want to include the isAltDown()==true in the keylistener. So this will ensure alt key is pressed with the letter key in order to activate the mnemonic.

You mentioned the Alt+key combo is first entered in the text field... try printing the text in the text field too. If this text includes the combo, you have another problem even if the trigger works.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi Tsang,

thanks for your answer.
Yes, unfortunately I have the problem of the "non-requested" character really ending up in the text field - so I really have an invalid entry in the text field!

(The listener itself works - first the character is entered and then immediately the listener is called...)


I agree. Here's the link:
subject: Mnemonics problem on Mac OS
It's not a secret anymore!