I am trying to open up an JFrame with an gif-loading animation from another JFrame. The problem is, that the new JFrame opens but the gif animations just shows up if the loading time is over, so there is a empty JFrame during the whole loading sequence.
I am trying to open up my new JFrame in my current JFrame like this:
Ladescreen loading = new Ladescreen();
loading.setVisible(true);
loading.pack();
And this is how my Loadingscreen is built:
public Ladescreen() {
setTitle("Crawling through files...");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 157, 207);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JPanel panel = new JPanel();
contentPane.add(panel, BorderLayout.NORTH);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JLabel picture = new JLabel();
picture.setIcon(new ImageIcon("football.gif"));
panel.add(picture);
JPanel panel_1 = new JPanel();
contentPane.add(panel_1, BorderLayout.SOUTH);
JLabel lblNewLabel = new JLabel("Loading...");
panel_1.add(lblNewLabel);
}
Can you tell me how to fix this up ?