Since JDK 1.4.0 the processKeyEvent does no longer report KEY_PRESS or KEY_RELEASE of the TAB key, damn did anybody find a workaround for this ?
Yes i have enabled AWT KeyEvents ! everything else works fine ( like ENTER or BACKSPACE )
Since JDK 1.4.0 the processKeyEvent does no longer report KEY_PRESS or KEY_RELEASE of the TAB key, damn did anybody find a workaround for this ?
Yes i have enabled AWT KeyEvents ! everything else works fine ( like ENTER or BACKSPACE )
I think what you want is
// I’d like to see the TAB, Shift-TAB events, thank you:
(myFrame).setFocusTraversalKeysEnabled( false );
during the setup of your Frame
You can set that for a specific component and have tab work as a focus traversal key in other components…
That little change by Sun will have broken any old code that relied on the tab key.
Its also counterintuitive that processKeyEvent reports all KeyEvents except the Tab key.
IMO, that is a bug :-/
yes thanks for that info, if u write an applet based on 1.1 and this applet is running under 1.4, you will get no TAB key pressed.
Now i dynamically load the method and invoke it ( if the method exists ).
Thats the workaround and i am happy, i have now a TAB key again.
[quote]That little change by Sun will have broken any old code that relied on the tab key.
Its also counterintuitive that processKeyEvent reports all KeyEvents except the Tab key.
IMO, that is a bug :-/
[/quote]
A change in behaviour but not a bug. They needed to improve focus support. Tabbing between text fields on a form, etc. Sometimes you have to break compatibility to move forward… something Microsoft should learn some day COUGHDOS SHELLCOUGH
i understand the need for the focus managment; but there is no reason why the KeyEvent can’t be delivered to processKeyEvent as well as being processed by the focus manager.
Is there?
I never use native controls, i have my own set of controls ( edit, listboxes and so on ) and tabbing was working wonderful and is still working with 1.4, but Panels and Frames do not get the TAB Key Event, i hate Swing ( heavy ) and i only use AWT.
With the knowledge that this behaviour has changed, its easy to implement the fix i posted above.
[quote]i understand the need for the focus managment; but there is no reason why the KeyEvent can’t be delivered to processKeyEvent as well as being processed by the focus manager.
Is there?
[/quote]
The reason that comes to mind is that if you have a text component and someone hits TAB you want to EITHER type a tab character into the components document, OR move focus.
If the TAB is added to the document AND the focus changes that is obviously a problem.
In other words you don’t want the one key press to do two unrelated things (e.g. bring up a chat window in your game and move focus to your QUIT button.)
Sure there might be other ways to solve this, but they could just complicate things even more.
P.S. I LOVE Swing (heavy)