
Have written the following code (with help from this website).My problem is that i want the JProgressBar to disappear and a new JFrame to appear as soon as the progress bar is complete. Please Help!!!!!!
Here is my code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Progress
{
JFrame jf;
JProgressBar jpb;
Thread runner;
int num = 0;
Progress()
{
JFrame jf=new JFrame();
jpb=new JProgressBar(0,100);
jpb.setValue(0);
jpb.setStringPainted(true);
jpb.setString("Loading....");
jf.add(jpb);
jf.setSize(500,25);
jf.setUndecorated(true);
jf.setVisible(true);
jf.setResizable(false);
jf.setLocation(450,250);
}
public void iterate()
{
while (num < 1000)
{
jpb.setValue(num);
try{
Thread.sleep(500);
}
catch (InterruptedException e){ }
num += 10;
if(num==100)
new Screen1();
}
}
public static void main(String args[])
{
Progress p=new Progress();
p.iterate();
}
}
PlEASE HELP!!!!!

1)Progress.java:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Progress{
JFrame jf;
JProgressBar jpb;
Thread runner;
int num = 0;
Progress(){
JFrame jf=new JFrame();
jpb=new JProgressBar(0,100);
jpb.setValue(0);
jpb.setStringPainted(true);
jpb.setString("Loading....");
jf.add(jpb);
jf.setSize(500,25);
jf.setUndecorated(true);
jf.setVisible(true);
jf.setResizable(false);
jf.setLocation(450,250);
}
public void iterate(){
while (num < 1000){
jpb.setValue(num);
try{
Thread.sleep(500);
}
catch (InterruptedException e){ }
num += 10;
if(num==100)
new NextPage().setVisible(true);
}
}
public static void main(String args[]){
Progress p=new Progress();
p.iterate();
}
}
2)NextPage.java:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class NextPage extends JFrame
{
NextPage()
{
setLayout(null);
setDefaultCloseOperation(javax.swing. WindowConstants.DISPOSE_ON_CLOSE);
JLabel lab=new JLabel("Welcome ");
lab.setBounds(10,10,500,20);
add(lab);
setSize(300, 100);
}
}

Thanx for your help.But i want the JProgressBar to disappear and only the JFrame of the file NextPage.java to be displayed on the screen. Please help!!!!!
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.