This code can be added to any event like a listener, button, etc. A blocking JDialog will appear and will remain until the process is complete.
final JDialog loading = new JDialog(parentComponent);
JPanel p1 = new JPanel(new BorderLayout());
p1.add(new JLabel("Please wait..."), BorderLa...