I am creating swing application. I am using netbeans, I have added jprogress bar on container but I have no idea how to start. I need jprogressbar to show loading. I have created a jframe which contains jprogressbar. on jframe load I want to start jprogressbar and run for say 5 seconds. close that frame and want to open new jframe.
Asked
Active
Viewed 702 times
0
-
1Look at: http://stackoverflow.com/questions/11399971/make-splash-screen-with-progress-bar-like-eclipse or http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html – bobbel Jan 31 '14 at 08:58
-
@Ashish..if you found helpful you can upvote my answer.. thanks anyway.. – Java Man Jan 31 '14 at 12:44
-
not eligible for vote up yet. need 15 reps – Ashish Kudale Jan 31 '14 at 12:48
1 Answers
0
Use this code for loading Screen.
import java.awt.*;
import java.awt.event.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
public abstract class demo extends Frame implements ActionListener
{
public demo() {}
public static void main (String args[]) {
try {
JWindow window = new JWindow();
window.getContentPane().add(new JLabel(new ImageIcon("/home/ubuntu/NetBeansProjects/demo/gimpsplash.gif"), SwingConstants.CENTER));
window.setBounds(500, 150, 300, 200);
window.setVisible(true);
try
{
Thread.sleep(5000);
} catch (InterruptedException e)
{}
window.setVisible(false);
JFrame frame = new JFrame();
frame.add(new JLabel("Welcome Swing application for Ashish.."));
frame.setVisible(true);
frame.setSize(300,200);
window.dispose();
} catch (Exception ex) {
Logger.getLogger(Kapildemo.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Replace ImageIcon path ImageIcon("/home/ubuntu/NetBeansProjects/demo/gimpsplash.gif")
with your path and you done..
Thanks..

Java Man
- 1,854
- 3
- 21
- 43