Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

requestfocusinwindow going to lostfocus event thrice

 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

Please see the following code



Here, if the textfield is left empty, the result string is displayed and txtphone field gains focus. So far so good. But as soon as it gains focus it again automatically comes to this focuslost method thrice. I fail to understand, why this is happenning.

Please help
 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed one more thing. When the message dialog box appears for the first time, and if you drag it, there lies an identical dialog box beneath it and one more beneath it. This makes me to think that three dialog boxes, one below the other, are being opened probably.
 
Mario Bud
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how is this method called? normally you implement focuslistener and override focusGained and focusLost. I guess you call your method from there?
a) Are you sure your method is only called on focusLOST?
b) are you sure that the txtphone-inputfield is the only component which uses this specific focuslistener?
 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using netbeans and I have written this code in netbeans txtphone focuslost event section. I think so far as over-riding etc. are concerned, netbeans must have handled those issues.
As I have written the code in txtphone focuslost event section, I think it should be invoked only when txtphone field looses focus.
 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting the entire code for your convenience

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you have posted is too long for the problem. To get answers, post your SSCCE.
 
Robbie Parks
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was there found a solution to this problem? I am fighting the same.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49405
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After nearly four years, the OP may not come back to reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic