I have a JFrame
with progress bar and my code which should run it in background showing the progress in progress bar.
I implemented runnable in my Progressbar class and started the thread. But the progress bar frame is not displaying full.. and it gets stuck and it display full after my code is fully executed i.e after main thread close.
I know this is some basic mistake.
public class ProgressScriptUI extends JFrame implements Runnable{
@Override
public void run() {
// TODO Auto-generated method stub
setTitle("Progressing to Generate DDL Scripts");
setBounds(400, 250, 850, 400);
getContentPane().setLayout(null);
JProgressBar progressBar= new JProgressBar(0,100);
progressBar.setBounds(200, 100, 500, 20);
add(progressBar);
setVisible(true);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
//I am calling the below code in some other class
ProgressScriptUI progress = new ProgressScriptUI();
Thread uiThread = new Thread(progress);
uiThread.start();
oracleValidateOLDorNEW.execute(); //Code that I need to call in back ground