• 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

Issues when popup a dialog from keyReleased event

 
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:

I just noticed a strange issue: I have a JTextField (testText) in my GUI, which registered a keyListener, when I popup a dialog in its keyReleased() function, pressing "enter" key on dialog causes keyReleased event on JTextField endlessly. However, it's ok using mouse clicking on "ok" on dialog. The same dialog works fine in keyPressed() function.


When above code running on jdk1.4.2, I pressed any key (ex. "Esc" or "Enter") key on that text field, this_keyReleased() is invoked, and a message dialog is popped up with focus on "OK" button on that dialog. So, when I pressed "Enter" key, for some reasons the keyReleased event is fired again and the same message dialog is popped up again, so, keeps pressing "Enter" key, keeps popping up the same dialog endlessly. However, moving this_keyRelease() from keyReleased() to keyPressed(), everything seems ok.
So, could any one please give me some hints how does that happen? Is that from some focus issues? or is that a bug in jdk1.4.2?

Thanks a lot in advance

David
 
reply
    Bookmark Topic Watch Topic
  • New Topic