• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdk 1.4 requestFocus issue

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic