wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes requestfocusinwindow going to lostfocus event thrice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "requestfocusinwindow going to lostfocus event thrice" Watch "requestfocusinwindow going to lostfocus event thrice" New topic
Author

requestfocusinwindow going to lostfocus event thrice

Anand Shrivastava
Ranch Hand

Joined: Jul 22, 2007
Posts: 125
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
SCJA
Anand Shrivastava
Ranch Hand

Joined: Jul 22, 2007
Posts: 125
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

Joined: Sep 09, 2011
Posts: 3
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

Joined: Jul 22, 2007
Posts: 125
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

Joined: Jul 22, 2007
Posts: 125
I am posting the entire code for your convenience

Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1075
    
  10

The code you have posted is too long for the problem. To get answers, post your SSCCE.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: requestfocusinwindow going to lostfocus event thrice
 
Similar Threads
Issues on focus with composites and their child widgets
focus not working
Alerts and textbox losing focus
How many times can finalize() be invoked?
focus of JPanel