znôrt <kktuapower@yahoo.es> wrote in message news:<3jeu40d8ghd5js9qr9n1o1duapq4cdjm6o@4ax.com>...
>znôrt <kktuapower@yahoo.es> wrote in message news:<3jeu40d8ghd5js9qr9n1o1duapq4cdjm6o@4ax.com>...
>> Hi all
>>
>> I have all my application dialogs derived from a single customized
>> JDialog that installs a KeyListener to handle help requests through
>> the F1 key, like this:
[...]
>> While switching from 1.3 to 1.4 I also changed all intput fields from
>> JTextField to JFormattedTextfield, wich uses InputVerifier. Could this
[quoted text clipped - 6 lines]
>JTextField/JFormattedTextfield, you have to add keylistener onto it,
>not onto the JDialog itself.
Thank you and sorry for my late posting. This happens regardless of
where the focus is when F1 is pressed.
Back in my version using 1.3+JTextField, it also worked regardless of
focus position, even when it was owned by a JTextField.
This issue isn't very much high priority, so I haven't still put hands
on it really. Just wanted to know in the meanwhile if anybody had
experienced anything similar. Thank you again for your comments.
regards
znôrt
zn?rt - 22 Mar 2004 16:02 GMT
Defintely, adding a global KeyListener won't work on 1.4 if you add
something like a JTextField or JButton to the container. I can swear
it did work on 1.3 :-)
Workaround:
Let the base container class implement ActionListener and ...
this.getRootPane().registerKeyboardAction(this,KeyStroke.getKeyStroke(KeyEvent.VK_F1,0),JComponent.WHEN_IN_FOCUSED_WINDOW);
regards
znôrt