File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes waiting or loading screen in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "waiting or loading screen in java" Watch "waiting or loading screen in java" New topic

waiting or loading screen in java

jamil lusa
Ranch Hand

Joined: Aug 18, 2011
Posts: 59
hi all,

i am running a program that execute quite a numbers of loop. the program will not be responsive when running with those loop. i want to create a form that stay on top of the program and notify the user about the progress of execution.

How can i do that? i try to google the example but no luck. and the clue point me to use threading which i am not really good at (know a bit).

can anyone show me a very simple coding regarding to this problem? just a simple waiting form stay on the main form when the main program is executing a huge loop. after loop finish, the waiting screen gone.

Thanks your all help in advanced!
John Jai

Joined: May 31, 2011
Posts: 1776
If the UI is Swing then you can use the wait cursor.
jamil lusa
Ranch Hand

Joined: Aug 18, 2011
Posts: 59
i need a form-like waiting screen instead of waiting cursor because it can provide more information (display on the waiting form) for the user.
Tim Moores

Joined: Sep 21, 2011
Posts: 2413
What prevents you from putting a dialog in front of the main window whenever you need to?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46362
I think this thread would sit better on our GUIs forum, so shall move it.
Please avoid coloured text; some people find it very difficult to read.
Darryl Burke

Joined: May 03, 2008
Posts: 5115

Have you considered using a ProgressMonitor? you'll find a link to a tutorial from the API of the class.

luck, db
There are no new questions, but there may be new answers.
jamil lusa
Ranch Hand

Joined: Aug 18, 2011
Posts: 59
Thank Darryl, ProgressMonitor is good to use.


hi all, but i am still curious how to create a customized loading form (something like showing 'please wait...') by myself using threading because it is a good chance to learn that.

anyone is kind enough to show me? thanks.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
here's a quick (rough) example

click the button, the dialog will show, you can move the dialog, but not close it or access the frame
when the task is over, the dialog disappears, and you can again access the frame

(this is not a good example of doing what you want, ProgressMonitor is the better/best way)

Rob Spoor

Joined: Oct 27, 2005
Posts: 20274

Why not use a SwingWorker in that example?
I agree. Here's the link:
subject: waiting or loading screen in java
It's not a secret anymore!