• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple Message that doesn't require response from User?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Came across this from the Developer Certification forum, as part of a post under the heading 'nx: contractor - max please help', posted by Mike Southgate with a reply from Andrew Monkhouse, back in 2003:-

Hi Mike

Is there a simple box in swing that you can show, like a dialog except that it doesn't require a user response? If there were I could just show it before I do the lock and then make it invisible when I get the lock number. Something like the JOptionPane except without the buttons...

So many options to choose from ....
You could just have a status bar at the bottom of your main window, and put a message in there telling your users what you are doing.
Or you could create a custom JOptionPane / JDialog
Or you could create a custom JWindow
Regards, Andrew



Has anyone implemented anything like the custom JOptionPane/ JDialog or custom JWindow that Andrew suggests?

I maintain an old app that includes functionality for the user to run parameterised searches. User is prompted to enter/lookup parameters to complete a dialog box. Then when they click 'OK' the action validates the input and either presents a dialog to user advising missing/invalid parameter, or displays an animated dialog showing that the search is in progress. This functionality was originally intended to run simple searches (usually single sql statements) so the validation phase is usually very quick; of late, however it has been used for some much bigger multi-sql statement searches, and for these there can be a perceptible delay between invoking the search and user seeing either an 'invalid or missing parameter' dialog or the 'animated running search' dialog. It would seem to be a nice solution to display a simple message 'Initialising Search....' or 'Validating Input.....' when the action is invoked and then hide it when validation fails/the search starts running.

My Swing knowledge isn't that deep but always willing to learn more, all advice/suggestions gratefully received,

Thanks,

Malcolm
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is the one that just has an OK button to close it
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read the section from the Swing tutorial on Concurrency. You could use a Swing Worker.

When you start your task you display the dialog. When you finish the task you hide the dialog.
 
Malcolm Clews
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Randall/Rob,

Thanks for your replies.

Randall - is there any way you know of to not display 'OK' or any other options? - i.e. I don't want the 'dialog' aspect of the dialog box, so to speak. If not:-

Rob - the 'animated running search' dialog uses SwingWorker - I guess I can adapt that code to display a similar animated dialog for the validation phase including a 'Cancel' option on the dialog - just seemed like overkill just to display a transient informative message to the user.

Thanks again guys,

Regards,

Malcolm
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not at all overkill. When you execute a long running task you should always be using a separate thread so you don't block the GUI.
 
Malcolm Clews
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob - will be working with your suggestions over the next few days - Cheers Malcolm
reply
    Bookmark Topic Watch Topic
  • New Topic