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 JOptionPane question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane question" Watch "JOptionPane question" New topic

JOptionPane question

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
I want a dialog box to open with an informational message and remain
open for 3 seconds then close. Can I do this with JOptionPane? If not,
what should I use?

Joe Ess

Joined: Oct 29, 2001
Posts: 9188

From the Java Tutorial: How To Make Dialogs

For most simple modal dialogs, you create and show the dialog using one of JOptionPane's showXxxDialog methods. . . If you need to control the dialog's window-closing behavior or if the dialog isn't modal, then you should directly instantiate JOptionPane and add it to a JDialog instance. Then invoke setVisible(true) on the JDialog to make it appear.

[How To Ask Questions On JavaRanch]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You can use a JWindow with a timer.
I agree. Here's the link:
subject: JOptionPane question
It's not a secret anymore!