Create Modal JDialog while things are processing Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Create Modal JDialog while things are processing without wasting too much if your time.

The question is published on by Tutorial Guruji team.

how do you create a Modal JDialog saying “loading” while a task is processing that shows after more than 3 seconds has passed?

Answer

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.

We are here to answer your question about Create Modal JDialog while things are processing - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji