I would like to implement some JOptionPane which displays when some process is going on, and auto-close when that process is completed. Basically, I want something like:
JOptionPane enumeratingFiles = new JOptionPane("Enumerating files...");
JDialog enumerationDialog = enumeratingFiles.createDialog(this, "Enumerating files");
enumerationDialog.setVisible(true);
// code for file enumeration
enumerationDialog.dispose();
I do not know threading, and because of that, would like to try to avoid it. However, I try the above in a JPanel
in JFrame
, and enumerationDialog
fails to close. Is there any way to do this, without threading, or should I use Thread
? If I must use Thread
, how?