I\'ve a JFrame subclass that manage my UI and call a method of Item Object to import items in my DB:
public TestGUI() throws IOException
{
initComponents();
This is how you should use it:
class ProgressBar extends Thread{
public void run(){
System.out.println("Progress Bar - start");
try {
Thread.currentThread().sleep(2000);
} catch (InterruptedException e) {}
System.out.println("Progress Bar - end");
}
}
public class ThreadDemo {
public static void main(String[] args) throws InterruptedException {
System.out.println("Main Thread Start");
Thread t1 = new Thread(new ProgressBar());
t1.start();
t1.join();
System.out.println("Main Thread End");
}
}
OUTPUT:
Main Thread Start
Progress Bar - start
Progress Bar - end
Main Thread End