I recently switched from PPC 10.4.11 (Tiger) to Intel/Leopard.
A project of mine has code like this:
protected void processAWTEvents (AWTEvent[] evt)
{
for (int ii = 0 ; ii < evt.length ; ++ii)
{
if (evt [ii] instanceof KeyEvent)
{
int type = evt [ii].getID();
int code = ((KeyEvent) evt [ii]).getKeyCode();
String text = KeyEvent.getKeyText (code);
System.out.println ("type : " + type);
System.out.println (" code: " + code);
System.out.println (" text: " + text);
[... etc.]
This function is called (by Java3D) every time a key is pressed. So
far, so good.
On my PPC/Tiger system, the println(text) would show things like
"LEFT_ARROW" and "SHIFT_KEY", etc. for those keys.
On my Intel/Leopard system, I get this:
[Session started at 2008-01-25 18:50:00 -0800.]
Pigs!
type : 401 // (401 = keydown)
code: 32
text: ? // <space>
type : 400 // 400 = key-repeat? Key-typed? Whatever...
code: 0
text: Unknown keyCode: 0x0
type : 402 // (402 = keyup)
code: 32
text: ?
type : 401
code: 37 // left arrow
text: ?
type : 402
code: 37
text: ?
type : 401
code: 39 // right arrow
text: ?
type : 402
code: 39
text: ?
type : 401
code: 38 // up arrow
text: ?
type : 402
code: 38
text: ?
type : 401
code: 40 // down arrow
text: ?
type : 402
code: 40
text: ?
type : 401 // various meta keys follow...
code: 16 // shift, cntl, CMD, fn, etc.
text: ?
type : 402
code: 16
text: ?
type : 401
code: 157
text: ?
type : 402
code: 157
text: ?
type : 401
code: 18
text: ?
type : 402
code: 18
text: ?
type : 401
code: 17
text: ?
type : 402
code: 17
text: ?
Any ideas what happened, and how I can fix it?
Thanks!

Signature
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
Daniele Futtorovic - 28 Jan 2008 20:12 GMT
> I recently switched from PPC 10.4.11 (Tiger) to Intel/Leopard.
>
[quoted text clipped - 6 lines]
>
> Any ideas what happened, and how I can fix it?
According to the doc for KeyEvent#getKeyText:
"Returns a String describing the keyCode, such as "HOME", "F1" or
"A". These strings can be localized by changing the awt.properties file."
Sounds like your problem is with the distributor of your JRE/SDK.
DF.

Signature
Can I put my pants back on now?