Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Swing: Modal loading screen?

Tags:

swing

I have a Java swing application which loads a web page. Sometimes, the web page takes a while to load depending on the user's internet connection.

I want to block this frame until page has loaded.

like image 631
KJW Avatar asked Feb 02 '11 02:02

KJW


1 Answers

The simplest option is to pop up a modal dialog:

JDialog modalDialog = new JDialog(frame, "Busy", ModalityType.DOCUMENT_MODAL);
modalDialog.setSize(200, 150);
modalDialog.setLocationRelativeTo(frame);
modalDialog.setVisible(true);

You may want to put a progress bar in it.

like image 86
Russ Hayward Avatar answered Oct 13 '22 06:10

Russ Hayward