Creating a dialog box

Hi Experts

I am trying to create a dialog box that displays an information message on the screen (i.e. one that does not need the user to react to it, or close it, or click on anything), but which also lets the program continue in the background. I have been able to create dialog boxes before but they always need the user to either close the window or click on a button and will suspend the program until the get a response.

I'm after something simple like this:

informationbox.open("I'm doing (whatever it is)");
Do the process
informationbox.close();

All the sites I have gone to explain how to create dialog boxes but this not what I want. Any suggestions?

zaphod_beeblebroxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

radarshCommented:
JOptionPane.showMessageDialog should be used

________
radarsh
0
CEHJCommented:
JDialog d = new JDialog(yourFrame);
d.setModel(false);
0
CEHJCommented:
>>d.setModel(false);


should be

d.setModal(false);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

objectsCommented:
   JOptionPane pane = new JOptionPane(message);
    JDialog dialog = pane.createDialog(parentComponent, title);
    dialog.setModel(false);
    dialog.setVisible(true);

    // do your stuff

    dialog.setVisible(false);
0
objectsCommented:
that'll teach me to cut/paste code without checking it for erroers :-D

   JOptionPane pane = new JOptionPane(message);
    JDialog dialog = pane.createDialog(parentComponent, title);
    dialog.setModal(false);
    dialog.setVisible(true);

    // do your stuff

    dialog.setVisible(false);
0
zaphod_beeblebroxAuthor Commented:
Thanks CEHJ and Objects both excellent answers. I did not believe how simple it was -- just make the dialog box non modal!!!

Works great thanks again guys for your most excellent answers
0
CEHJCommented:
:-)
0
sriki77Commented:
Hi zaphod_beeblebrox,

I am not sure whether you can do this:

You can activate the GlassPane of your component, instead of showing a dialog box. Place you message on the glasspane. Actvitating the glasspane is like showing a splash screen in the application, application runs and user input is blocked. Once the application finishes its job, hide the glasspane. All the user input consumed by the glasspane is directed to the application.

yourcomponent.getRootPane().getGlassPane().setVisible(true);
//the application does the required work
yourcomponent.getRootPane().getGlassPane().setVisible(false);

Have a look at this link from the java tutorial: http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

Cheers!
0
objectsCommented:
glad I could help :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.