My project follows the following flow:
I want to use swingworker.Here is the way i am using it but the results are not coming correct
In my GUI code, my code is this for executing the principal class
I have written the following lines of code in buttons code
Main f2 = new Main();
f2.execute();
In my Principal class ,i have done this
class Principalclass extends SwingWorker<Void, Void>
{
@Override
public Void doInBackground() throws IOException
{
//while loop
}
@Override
public void done() {
System.out.println("I am DONE");
GUI b = new GUI();
b.ShowFrame(); //calls the function of the GUI to display frame
}
Now this code without printing "I am DONe" displays the GUI frame.I am confused if i have to do some changes in classes 2,3 and 4 bcz i am using swingworker or if i have to do further changes only in Principalclass.Secondly,the application which should take 15 mins to complete its task,it just takes 2 secs :(.May be i am doing something seriously wrong because i am using swing worker for the first time.