Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

waiting or loading screen in java

 
jamil lusa
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the UI is Swing then you can use the wait cursor.
 
jamil lusa
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2790
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What prevents you from putting a dialog in front of the main window whenever you need to?
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you considered using a ProgressMonitor? you'll find a link to a tutorial from the API of the class.
 
jamil lusa
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use a SwingWorker in that example?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic