Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KeyEvent.getKeyText() went wonky (won't display arrows)



(Oops, sent from the wrong account, 1st time.)

Begin forwarded message:
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!

_______________________________________________ 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

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.