I've programmed a tool that opens and parses files. As this is taking some time, I wanted to make a little status window, by now it's just consisting of a JLable with the text "Import running, please wait...".
However, during runtime it looks like this:
After the file import is finished, the window is fine, showing the text and everything. I tried programming it without Threads at first, then I thought maybe making it multithreaded will help. So I made the window open in it's own Thread, the file import in it's own Thread and finally both in their own Thread. The result still was the same.
Here is the code I'm using:
JLabel label = new JLabel("Importing file, please wait...");
JFrame frame = new JFrame();
frame.setSize(100, 100);
frame.add((new JPanel()).add(label));
//no difference to frame.add(label);
frame.setVisible(true);
//Parse File
openParseFile();
//Close status window after parsing complete
frame.dispose();
Does anybody have any ideas how to solve this? I tried googleing it, but the results only showed how to make a JLapel transparent, not the other way around.
Any help is appreciated,
Thanks
Sverre
Here's the solution, thanks to the comment of MadProgrammer and this tutorial: Javacreed SwingWorker Examle