How to create new thead
Hi,
I have main class that is Swing form. In this class I want to invoke second class which implements Runnable interface:
e.g.
publicclass mainClass
{
publicstaticvoid main(String[] args)
{
// I create a new Thread
Thread newThread =new Thread(new secondClass());
newThread.start();//run second thread
}}
publicclass secondClassimplements Runnable
{
progressFrame progress =null;
Thread progressBar =null;
publicvoid updateProgressBar()
{
progress.updateProgressBar(int value);//method in class with JProgressBar to update progressBar
}
publicvoid run()
{
/*Here I create third thread which is responsible for showing JProgressBar.
* This class olso implements Runnable
*/
progress =new progressFrame(null,false,getLengthOfTask (),true);
progressBar =new Thread(progress);
progressBar.start ();
updateProgressBar();
}
How can I write code in main method to be able to run other methods inside second method. Code below prevent repaint JProgressBar.
publicclass mainClass
{
secondClass second =null;
publicstaticvoid main(String[] args)
{
// I create a new Thread
second =new secondClass();
Thread newThread =new Thread(second);
newThread.start();//run second thread
}
}
Peter D.

