how do you create a Modal JDialog saying "loading" while a task is processing that shows after more than 3 seconds has passed?
If the task is to load an InputStream
, see ProgressMonitorInputStream
.
E.G. (untested)
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(
parentComponent, message, inputStream);
ProgressMonitor pm = pmis.getProgressMonitor();
pm.setMillisToPopup(millisToPopup);
It will be necessary to load the InputStream
in a Thread
in order to avoid blocking the EDT.