Help - Focuslost is trigered too many time during jtextfield validation.

Hi all,
I am designing a form containing multiple fields with field validations.
The program supposes bring the focus back to that particular field after the error message is displayed. However; the
error/warning message is displayed infinitely between the two focusLost events of the two Jtextfields when the focus is switched between the two jtextfields. I tried to google it, but there was no success.
Can anyone tell me why?
Thanks a lot.
core code
    private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {                                     
        // TODO add your handling code here:evt.getSource();
        JTextField roomTag=(JTextField) evt.getSource();
         String text = roomTag.getText();
         if (text.length() >= 3) {
            try {
                    Integer.parseInt(text);
            } catch(NumberFormatException nfe) {
             //    Toolkit.getDefaultToolkit().beep();
//SwingUtilities.invokeLater(new FocusGrabber(this.jTextField1));
               JOptionPane.showMessageDialog(null, "It must be a numeric value");
               //roomTag.requestFocus();
               jTextField1.requestFocus();
               //return;
         } else {
               JOptionPane.showMessageDialog(null, "It must be 3 chars at least");
               //roomTag.requestFocus();
                jTextField1.requestFocus();
                //return;
    private void txtPhoneFocusLost(java.awt.event.FocusEvent evt) {                                  
        // TODO add your handling code here:
        JTextField roomTag=(JTextField) evt.getSource();
         String text = roomTag.getText();
         if (text.length() <= 12) {
            try {
                Long a=Long.parseLong(text);
            } catch(NumberFormatException nfe) {
               JOptionPane.showMessageDialog(null, "The phone number must be a numeric value");
               txtPhone.requestFocus();
               //roomTag.requestFocus();
               //jTextField1.requestFocus();
               //return;
         } else {
               JOptionPane.showMessageDialog(null, "The phone number must be 12 chars at most");
                txtPhone.requestFocus();
               //roomTag.requestFocus();
                //jTextField1.requestFocus();
                //return;
                                     Edited by: ehope on Nov 1, 2009 5:14 PM
Edited by: ehope on Nov 1, 2009 5:18 PM
Edited by: ehope on Nov 1, 2009 5:21 PM

A search of the forum on two terms -- focusLost multiple -- came up with some interesting hits: [forum search|http://search.sun.com/main/index.jsp?all=focuslost+multiple&exact=&oneof=&without=&nh=10&rf=0&since=&dedupe=true&doctype=&reslang=en&type=advanced&optstat=true&col=main-all]
including a bug report and a work-around by camickr.
Another possible work around is to remove the focuslistener, then re-add it at the end of the focuslistener but via a Swing Timer to delay its re-addition.

Similar Messages

  • My daughter has entered the wrong passcode too many times, it is now disabled.  When I connect to iTunes, it will not let me go any further until I enter the correct passcode.  I no longer get the option to do this, all I get is iPOD disabled.  Help

    My daughter has entered the wrong passcode too many times on her iPOD Touch, it is now disabled.  When I connect to iTunes, it will not let me go any further until I enter the correct passcode.  I no longer get the option to do this, all I get is iPOD disabled.  Help Please

    Restore the iPod from the computer to which the iPod is synced. For information and instructions, see:
    http://support.apple.com/kb/ht1212
    If that will not work, you'll need to put the iPod into Recovery Mode and then try the Restore again:
    http://support.apple.com/kb/ht1808
    Regards.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base, before you post a question.

  • Just upgraded and iPhoto said it has to upgrade library but keeps freezing. Have tried it too many times now and I need those photos ASAP  HELP!!

    Just upgraded and iPhoto said it has to upgrade library but keeps freezing. Have tried it too many times now and I need those photos ASAP  HELP!!

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • My ipod is disabled because the password was entered incorrectly too many times.  Help

    my ipod is disabled because the password was entered incorrectly too many times.  Please help???

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen        
    If recovery mode does not work try DFU mode.                         
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • My adobe ID has been authorized too many times? Help?

    My ID has been authorized too many times. Help?

    This is the Reader aforum. The Digital Editions one is here:
    http://forums.adobe.com/community/adobe_digital_editions

  • HT1350 my kids entered the wrong unlock code on my ipod too many times and now the screen says ipod disabled connect to itunes. Well i try connecting to itunes and i cant because my ipod is locked! need help please!

    my kids enetered the wrong unlock code on my ipod touch too many times and now the screen says IPOD DISABLED connect to itunes. I have tried connecting it to itunes and I cant because the ipod is locked. need help please! any ideas? Thanks, Nick

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                          
    If recovery mode does not work try DFU mode.                         
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • HT5312 I have sadly forgotten my answers to my apple security and apparently guessed too many times.....what do I do now???? Plz help

    Need help I have forgotten my apple security questions and guessed too many times and won't let me reset. What do I do now???

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (114957)

  • HT6154 My iphone 4GS is disabled due to trying to log on too many time. I need help to get phone working again what do I do?

    I lost my I phone and I tried to find it. It put a passcode on it and I didn't know it. I tried to long on too many times and now my iphone is disabled. How do I restore?

    See this support document for instructions. You need to restore the phone. http://support.apple.com/kb/ht1212

  • HT1766 My iphone is disabled because the wrong passcode was entered too many times.  Can you help me with this?

    I entered the wrong passcode too many times and now my iPhone is disabled.  What can I do to retrieve the passcode?

    iOS: Forgotten passcode or device disabled after entering wrong ...

  • Ipod disabled wrong passcode entered too many times. help.

    entered the wrong unlock passcode too many times. Now ipod is disabled and it won't connect to itunes.

    Hello brams25,
    You'll need to connect your iPod Touch to your computer and iTunes in Recovery Mode and restore it.  See this article for instructions on how to place your iPod into recovery mode.
    iPhone and iPod touch: Unable to update or restore
    B-rock

  • Help please - Blackberry Torch - My password was entered incorrectly too many times and contacts deleted. No backup

    My friends child has entered my password incorrectly too many times and my contacts and texts are now gone. The last back up was completed in August 2011, I havent completed a new backup yet - Is there a way of getting all the data since then without a current backup? 

    Hi Cid_L,
    Welcome to the Community,
    Well that's a bad news, it seems no other source from where you can recover your data unless you had done backup using Blackberry Protect  and if you had not done that then I am sorry there is no other way of getting it back.
    Prince
    Click " Like " if you want to Thank someone.
    If Problem Resolves mark the post(s) as " Solution ", so that other can make use of it.
    Click " Like " if you want to Thank someone.
    If Problem Resolves mark the post(s) as " Solution ", so that other can make use of it.

  • TS3682 I have tried to restore me iPod that is disabled due to typing in the wrong password too many times. iTunes keeps giving me a box saying that it can't connect because I need to type in the passcode on the iPod (which I can't) what do I do now?

    I have followed the steps provided by apple to restore an iPod touch. It is disabled due to having the wrong password entered too many times. When I get part way through the restore process on my computer it pops up a box saying that it can't restore until I enter the passcode into the iPod. I have tried this same process over 5 times now and keep gutting the same results. It is my kids iPod and he has only had it since September. Someone please help me before I throw the thing through the window and my kid strangles me!!! Thanks!

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen        
    If recovery mode does not work try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • How do I reset my Ipod if the passcode that was put on it was entered wrong too many times and it disables the ipod?

    My son put a passcode on his IPOD TOUCH and couldnt remember it and entered it too many times. Now it has disabled the Ipod and says please connect to ITunes and ITunes will not connect to it because it has been disabled, I have already spoke to an Apple representative and did exactly what they told me to do to help reset the Ipod but that didnt work. So I am trying to figure out how we can get back into his IPod even if we have to factory reset it because nothing is working, not their instructions or the internet instructions for reseting it.

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device
    1. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. iOS- Understanding passcodes
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. How to Recover Forgotten iPhone Restrictions Passcode | The iPhone and iPad
    6. Restoring iPod touch after forgotten passcode
    7. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    Restrictions Passcode Help
    1. How to Recover Forgotten iPhone, iPad Restrictions Passcode

  • My phone every night keeps playing songs and stops by itself and Siri also keeps coming on without me even touching it everytime I watch a video. I don't know if my phone is hunted or because I just dropped it too many times. What should I do?

    So everytime I watch a movie or listen to music when I use my earphones. A song keeps playing by itself and Siri activates by itself without me even touching it. So I deactivated Siri. And now it's the voice control that keeps coming on.  I don't know if my phone is haunted, or there's something wrong with my earphones/earphone socket/jack (or whatever you call where you put it in the earphones), or is it just because I dropped my phone too many times. And I don't want to reset my phone if that's what I have to do. By the way I have an iPhone 4s

    If you are wondering why you are not getting any responses, it is because you have vented a complaint without any details that make any sense or give anyone something to work on.
    If you want help, I suggest actually detailing what has happened, with versions of software etc. Anything that would let us assist.
    As a start I am guessing that you have not really got the hang of "How it all works". Firstly download the Pages09_UserGuide.pdf from under the Help menu. Read that and view the Video Tutorials in the same place. A good addition would be the iWork 09 Missing manual book and something to help you learn how to use your Mac.
    If there are specific tasks you need help with:
    http://www.freeforum101.com/iworktipsntrick/index.php?mforum=iworktipsntrick
    Is a good resource.
    Peter

  • HT1212 Hi I would need somehelp ive tried a newpasscode and cant remeber the code tried it too many times now my iphone 4s is disactivated..i bought the phone i n a kiosque and there the ones who activated it with itunes  im now trying iy on another compu

    Hi there i need help on unblocking my phone .. tried a passcode too many times and its disabled now... i purchased the phone in a kiosque and they connected it to itunes to activate...im trying on a computer and its not letting me go threw...

    The article from which you came tells you what you need to do. If that fails, then you'll need to put the iPhone into recovery mode:
    http://support.apple.com/kb/HT1808
    Regards.

Maybe you are looking for

  • Javamail delete mail in READ_ONLY mode

    Hello, I want to fetch my GMail mails without deleting. My example code fetch e-mails, but the mail is delete from GMail account. I observe, that the line where is message.getContent() delete mail. If I remove this, the message is still alive. Thanks

  • Problem when upgrading to IOS7.0

    I downloaded and upgraded my IP4s to IOS7.0 but when I installed it, it required a passcode that I didn't know. I tried lots of passcode that I could think of but it didn't work. What should i do? Now I have to wait 1 hour to try again!!! Thanks much

  • Macbook Pro (15-inch, Mid 2012) Manual?

    I just purchased a Macbook Pro (15-inch, Mid 2012) last week and am hunting for a manual. It came with a little setup pamphlet and warnings brochure, both of which are available online as well. But is there a real user's manual--downloadable or hard

  • The cul-de-sac of BT "Customer Services"

    My family have used BT Broadband Talk over the years. I received an e mail yesterday telling me I had cancelled my BB Talk service which I hadnt. A 45 minute call to CS had an end result of me being told this service is no longer available and all my

  • Locker failed to offer due to timeout.Please increase worker thread count by increasing DeferredWorkerThreadCount in mediator-config.xml

    Can some one please assist me to get rid of the below error when trying to bring up the SOA services in Weblogic? "Locker failed to offer due to timeout.Please increase worker thread count by increasing DeferredWorkerThreadCount in mediator-config.xm