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
posted 14 years ago
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.