Forums Register Login

jdk 1.4 requestFocus issue

+Pie Number of slices to send: Send
Hi, there:

We upgraded our GUI application from jdk1.3.2 to jdk 1.4.2. Some codes to call requestFocus() that worked fine in jdk1.3.2 seems not work with 1.4.2.
I have a complicated function, at the end of function I called ComponentA.requestFocus() which I want to set focus to ComponentA. However in jdk1.4.2 it always set the focus to the first component in first panel.
The more strange issue is that, if I put a breakpoint at the end of the function, run it in debug mode, after stop at that break point, I just resumed the application, everything works fine, the focus was set to componentA.
So, is that some asynchronize issue in jdk1.4 focus api? how can I deal with that problem in 1.4?

Really appreciated if any hints, suggestions on that issue.

Thanks a lot in advance
David
+Pie Number of slices to send: Send
Hi, there:
Actually, by debugging further, I found the problem seems about ComboBox component. In summary, we used to use ComboBox.requestFocus() in both jdk 1.3 and jdk 1.4, it seems not work correctly in jdk1.4 for some reasons not sure yet. However, if I'm using ComboBox.getEditor().getEditorComponent().requestFocus() in 1.4 instead, it works the way I want.
So, now the question is what's the difference betweeen:
ComboBox.requestFocus() and ComboBox.getEditor().getEditorComponent().requestFocus().

could anyone please clarifiy it. Highly appreciate any hints.

Thanks a lot again
David
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 841 times.
Similar Threads
Focus issues among JTextField and Dialogs
Problem regarding the .class version
SET FOCUS
Focus problem in 1.4_2 when JPopupMenu show is called
Focus problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:05:16.