Jose,
Which JDK are you using ?
invokeLater() is available from even dispatch thread.
Following is an exerpt from JavaDoc of invokeLater().
If invokeLater is called from the event dispatching thread -- for example, from
a
Button's ActionListener -- the doRun.run() will still be deferred until all
pending
events have been processed. Note that if the doRun.run() throws an uncaught
exception the event dispatching thread will unwind (not the current thread).
Anyway, if you want your thread to return control to even thread after
heavy background processing, you can use thread.join().
But then, what's the use of using threading ?
- Ajit
Jose Antonio Lamas wrote:
> 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
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing