On Sep 12, 2006, at 3:10 AM, Elliott Hughes wrote:
rather than use un-Mac keyboard equivalents for everyone, i was
thinking of detecting "non English" keyboard layouts and using an
alternative there. only i can't work out how to do the detection.
You can ask the InputContext of a component for its locale. We
return the ISO language/country/variant for the currently selected
keyboard layout.
thanks; i'll have a look at that.
(if anyone knows how to get command-shift [ and command-shift ] to
work on a Danish keyboard, that would be better still.)
The problem here is that the DefaultKeyTypedAction in the
DefaultEditorKit blocks key-typed events with the META (Command)
key bit set. We had to change the logic in
javax.swing.text.DefaultEditorKit, because a key-typed event with
the ALT key was being blocked. On the Mac, option-whatever always
generates a valid key, so many non-ASCII values that could be
generated on a Mac keyboard would be lost. We changed it to look
for META, since command-whatever typically invokes a menu
equivalent and we don't want them to go to the text component...
except in this case.
no, sorry: i should have been more specific. i'm actually talking
about JMenuItem. i wanted Safari-like "Select Next Tab" and "Select
Previous Tab", and -- because Swing won't let you specify a keyboard
equivalent that isn't the primary symbol on a key -- i had to use the
work-around of asking for "shift [" rather than "{". this works fine
on a US keyboard (though the menu looks wrong because it shows
"command-shift [" instead of "command {"), but -- i'm told -- doesn't
work on a Danish keyboard.
curiously, the guy reporting the bug reckons that the "Window" menu
(which is why my JMenuItems are) flashes, but nothing happens. so
maybe there's a problem in my code that depends on the exact *keys*
required for a KeyStroke, or there's a problem in the code that
translates from the real Cocoa menus to KeyStrokes. would it be worth
asking the user to try a version that didn't useScreenMenuBar?
i think you tried to get Sun to fix the underlying problem ("can't
specify command {") before, but they closed your bug because they
didn't understand. i managed to get a "duplicate" open, though they
haven't done anything yet:
_______________________________________________
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