🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #56

Re: JButton events tricker twice

#56
From: Benedict
Date: Fri, 25 Nov 2005 15:50
109 lines
4370 bytes
I did, but there is nothing in the stack that points to the event being called twice.  To make sure it's not the code withing the event, I commented all code out except for one line.  It still keeps on repeating even with just one line of code within it.  

  public void jBtnImportAllFMEA_actionPerformed(ActionEvent e) {
    jTextArea1.setText("test");
  /*try {
      jTextArea1.setText("");
      quickExit: {

        File f = new File(UploadFolder);

        if (f.isDirectory()) {

          String filenames[] = f.list();
          fn = "";
          jTextArea1.setWrapStyleWord(true);
          for (int i = 0; i < filenames.length; i++) {
            if (isLocked(msoFMEAUploadFolder + filenames[i])) {
              fn = fn + "\nFile " + filenames[i] +
                  " is locked by another application.";
              break quickExit;
            }
          }

          for (int i = 0; i < filenames.length; i++) {

          }

          for (int i = 0; i < filenames.length; i++) {
            fn = fn + "Attempting to import " + filenames[i];
            if (filenames[i].endsWith(".xls")) {
              loadFMEA(msoFMEAUploadFolder + filenames[i]);
              fn = fn + " - done";
             
              moveFile(UploadFolder + filenames[i], FFolder);              
            }
            fn = fn + "\n";

          }

        }
      } 
      jTextArea1.setText(fn); 
    }
    catch (Exception ex) {
      ex.printStackTrace();
    } */
    
  } 
}

class msoImportFMEA_jBtnImportAllFMEA_actionAdapter
    implements ActionListener {
  private msoImportFMEA adaptee;
  msoImportFMEA_jBtnImportAllFMEA_actionAdapter(msoImportFMEA adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {

    adaptee.jBtnImportAllFMEA_actionPerformed(e);
  }
}

class msoImportFMEA_jBtnImportFMEA_actionAdapter
    implements ActionListener {
  private msoImportFMEA adaptee;
  msoImportFMEA_jBtnImportFMEA_actionAdapter(msoImportFMEA adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jBtnImportFMEA_actionPerformed(e);
  }
}





"Kevin Dean [TeamB]" <NkOdSePaAnM@datadevelopment.com> wrote:
>Benedict wrote:
>
>>
>>I have a JButton on my form that calls an actionPerformed event when 
>>clicked.  I perform some routines in it and everything works fine except 
>>for some reason the event is always trickered twice when the button is 
>>clicked. Any idea what could cause this and how to stop it from happening.
>
>Put a breakpoint in the event handler.  When the breakpoint is triggered, 
>press the green "Go" arrow at the bottom left to let the program continue 
>running.  When the breakpoint is triggered for the second time, look at 
>the "Stack" tab in the debugger to investigate the stack trace.  The odds 
>are that you are indirectly calling the event handler recursively, perhaps 
>by modifying the control in some way that is triggering the event a second 
>time.
>
>-- 
>Kevin Dean [TeamB]
>Dolphin Data Development Ltd.
>http://www.datadevelopment.com/
>
>NEW WHITEPAPERS
>Team Development with JBuilder and Borland Enterprise Server
>Securing Borland Enterprise Server
>http://www.datadevelopment.com/papers/index.html
>
>Please see Borland's newsgroup guidelines at
>http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <438740dc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43873391$1@newsgroups.borland.com> <xn0ea5qx47q2g0001-kdean@www.teamb.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,498f63d4e8842664
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Benedict" <kaupt@btinternet.com>
Sender: "Benedict" <kaupt@btinternet.com>
Reply-To: "Benedict" <kaupt@btinternet.com>
Subject: Re: JButton events tricker twice
Newsgroups: borland.public.jbuilder.java.swing
X-User-Info: 193.63.235.72     
X-Forwarded-For: 193.63.235.191
References:  <43873391$1@newsgroups.borland.com> <xn0ea5qx47q2g0001-kdean@www.teamb.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <438740dc$1@newsgroups.borland.com>
Date: 25 Nov 2005 08:50:36 -0700
X-Trace: newsgroups.borland.com 1132937436 207.105.83.66 (25 Nov 2005 08:50:36 -0700)
Lines: 110
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail