dcsimg
how to make jdialog or joption pane automatically vanish ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sarim_raza
Posted On:   Thursday, September 5, 2002 12:11 PM

its easy to make joption, but these guys only vanish when i click ok ..

if i want it to vanish automatically after some time (i know the time bit - using threads) .. is one way to remove() from the parent container and call validate() so that the
container refreshes ?

if parent container has border layout do i have to put dialog in some part of it, since dialogs normally visually appear to be independant (not fitted within a container).

the way joption function, we never put it inside any container, i wish to achieve the same, but make it vanish without clicking on its default ok button

thanks

Re: how to make jdialog or joption pane automatically vanish ?

Posted By:   Mike_Friedrich  
Posted On:   Friday, September 6, 2002 08:42 AM

You can try this:

final JDialog dialog = pane.createDialog(parentComponent, title);
new Thread() {
public void run() {
// wait your time
Thread.sleep(5000);
javax.swing.SwingUtilies.invokeLater(new Runnable() {
public void run() {
dialog.setVisible(false);
dialog.dispose();
}
});
}
}.start();
dialog.show(); // blocks the current thread


Regards, Mike

About | Sitemap | Contact