The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
June 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Thread Implementation

Posted by Tushar on June 22, 2000 at 8:40 PM

Hi ,
I hope you will answer the same in time..
I am facing a problem for implementing a thread for my process. Rather I don�t know where to implement the same in my whole code.

Could you provide some sample code/ working application which I can use as a template.
My application is something like this.

My main class extends JFrame
In it I am having a tree panel on left.
On click of any tree node, I need to process some data which takes several seconds.
For that time, I want to display a dialog box/progressbox on top of my current frame.

public class InfoCenter extends JFrame implements TreeSelectionListener, Runnable{
�..

public void valueChanged( TreeSelectionEvent e ) {

here I need to popup progressbar and make a call to method that will generate the data for me.
}

private getStatusForPrograms(){
///this is that time consuming process.
}

}//end class InfoCenter.


Now if I want to start a thread or thread(s) possibly one for progressbar and another for the getStatusForPrograms (), how to do so?
From where should I call the getStatusForPrograms() and how to detect the completion of the getStatusForPrograms() so that I can hide the Dialog box.

So any inputs from you will be greatly helpful
Thanks and Regards
Tushar




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us