• Post Reply Bookmark Topic Watch Topic
  • New Topic

jdk 1.4 requestFocus issue

 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!