Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

clearGlobalFocusOwner() in KeyboardFocusManager  RSS feed

 
Chrissy Simpson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTextField which is in a JPanel in a JTabbedPane. I have added a close() method to my class which extends JPanel. Before i do some processing in the close method, I need to ensure that all FocusListeners receive a FOCUS_LOST event. I am trying the following but it is not working:
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner()
If I call getFocusOwner() before the above line, the component is a JTextField. This text field never receives a FOCUS_LOST event and if I call getFocusOwner() after the clearGlobalFocusOwner() call, the component is the same as it was before the call.
Am i doing something wrong? any ideas?
 
Chrissy Simpson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doh! Looks like this was a bad post. It is amazing what a break and some food can do for brain power. The TextArea had already lost focus which is why the call to clearGlobalFocusOwner() was not throwing a FOCUS_LOST event. Sorry!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!