I have not done much with applets but I assume threads work about the
same as in applications.  The SwingWorker API is a great little tool for
spinning off heavy code and keeping your GUI responsive.  You can get
more info on using the SwingWorker here:
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html 

hope this helps.

Jon



Message: 1
From: "Jose Antonio Lamas" <[EMAIL PROTECTED]>
To: "Advanced-Swing" <[EMAIL PROTECTED]>
Subject: Threads inside actionPerformed event
Date: Mon, 11 Jun 2001 17:03:48 +0200

Hi,

I would like to know if there is any way to run a thread inside an
"actionPerformed" event. The point is to return the control after the
button
is pressed while the created thread is doing a background job. The
applet
runs the thread but doesn't return the control, and "invokeLater" is
not
available inside the event.

Example:

jButton1ActionPerformed (java.awt.event.ActionEvent evt)

        Runnable runner = new Runnable() {
          public void run() {
              try {
                    // HEAVY BACKGROUND PROCESSING
                } catch(Exception e){
                        System.out.println(e);
                }
          }

        //RETURN FASTLY CONTROL

}


Thanks
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to