🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1715

repeating the showMessageDialog

#1715
From: Ant�nio Ferreira
Date: Mon, 15 Oct 2001 09:49
36 lines
1974 bytes
Hi,

  I am having a problem with this code:

    jTextField1.addFocusListener(new java.awt.event.FocusAdapter() {

      public void focusLost(FocusEvent e) {
        int k;

          try {
            k = Integer.parseInt(jTextField1.getText());
            if (k < 1) {
              JOptionPane.showMessageDialog(null,
              "You must enter a value greater than zero",
              "Atention",
              JOptionPane.WARNING_MESSAGE);
              jTextField1.requestFocus();
            }
          }catch (NumberFormatException excp) {
            System.out.println(excp.getMessage());
            JOptionPane.showMessageDialog(null,
            "You must enter a numeric value.",
            "Atention",
            JOptionPane.WARNING_MESSAGE);
            jTextField1.requestFocus();
          }
      }
    });

  It always executes twice the appropiate showMessageDialog.
  Can anyone explain this strange behavior.
  I appreciate all your help.Thanks,


                                                            Ant�nio Jos�
Ferreira
Technical Details
Message-ID: <3bcab15a_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,ca11cf111dc9b441,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-10-15 03:02:07 PST
From: "Ant�nio Ferreira" <antonio.ferreira@artesis.co.pt>
Newsgroups: borland.public.jbuilder.java.api
Subject: repeating the showMessageDialog
Date: Mon, 15 Oct 2001 10:49:47 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 195.22.4.72
Message-ID: <3bcab15a_2@dnews>
X-Trace: dnews 1003139418 195.22.4.72 (15 Oct 2001 02:50:18 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews