Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Focus in a DeleteKeyListener

Mindy Lucas
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to clear out a non-editable combo box using the delete key. The delete key has a listener attached to it, which tries to force the focus to the previous combo box when the delete key is released. This all seems to be working alright except that when the action listener on the previous combo box fires, I have a check on the listener which checks to see if the component has focus and it's failing that check. Even though I've called requestFocusInWindow() method on the previous combo box, within the delete key listener.

I need for it to return true when it does the check on to see if the component has focus.

Note: I've tried using the invokeLater() and that doesn't seem to work either.

Any help would be much appreciated!!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic