Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FocusListener  RSS feed

 
Jack Lau
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have 2 JTextFields(jtf1 and jtf2) and both of them added FocusListener, when jtf1 lose focus, there is a lookup dialog popup and also for jtf2. The problem is that after jtf1 gain focus, and then I click the other fields, for example jtf2, a lookup dialog for jtf1 will pop up. However, after I click "yes" button for the lookup dialog for jtf1, the lookup dialog for jtf2 is poped up(May be cause by the focus lose of jtf2). There are 2 focus lost event.

I suppose there is only 1 focus lost event for jtf1 after clicking "yes" button the lookup dialog, the focus will come back to jtf1.

Does anyone know how to solve it? OR any other method (e.g. don't use FocusListener)

Thanks,
Jack
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if the sequence goes like this:

I would try adding a MouseListener to the JTextFields and launching the
JPopupMenu at mouseReleased.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!