I discovered that if you use "KeyEvent.VK_HELP" in Swing Menus that
you get a fairly pleasant character showing a "?" in a circle (on the
Macintosh OS X 10.4, Java 1.4.2).
So using code like "aMenuItem.setAccelerator(KeyStroke.getKeyStroke
(aKeyEvent, menuShortcutKeyMask));" then has this pleasant character
with the command/butterfly before it. Almost what we want - good
enough?
Of course, this key is not the same as a "?" but I'm sure it would be
possible to add a KeyListener to listen for "?"s being typed with the
menuShortcutKeyMask pressed. Then, if this is what the user presses
you can invoke the appropriate code to get the desired result.
Presumably this would work for Werner's "Shift + Apostrophe" example
on German Keyboards. (Incidentally, how do people with non-English
keyboards normally invoke help)
If on the other hand the the user presses command and the "Help"
button (below function keys F14 or F13 on desktop British keyboards)
then again help will show. In your KeyListener code you might also
want to capture just a plain press of the help button just to cover
all possibilities. Having said that pressing just "Help" seems to
put the Mac into a mode that I'm not familiar with - (a bit like
pressing the little "?" that appears in Windows Dialogs - maybe this
is a 10.4 feature - I don't know as I don't think I have ever pressed
the "Help" button before - only ever used Command-?).
Does this seem like a reasonable solution or have I missed
something. I don't know what VK.HELP looks like in Swing Menus on a
PC or other platforms
Best regards,
Ian Cheyne
On 15 Jun 2005, at 13:25, Manuel Hermann wrote:
What about Command-? as used on many help menus? Can I rely on that
across locales?
I haven't had any success to make Command-? work with Swing menus.
Manuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden