• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make jdialog or joption pane vanish automatically ?  RSS feed

 
sarim raza
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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) .. 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
 
Brett Swift
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if you have figured out the timed thread part, then why can't you just call the dispose method of the JOptionPane ? In the constructor, the first parameter is of type Component... so it wants the parent component. if you were creating the JOptionPane within the code of your parent frame somewhere...the code might look like this (of course your timer would encompass this code).

this pops up the JOption as a modal dialog in front of the parent frame. Hopefully that helped you out a bit?
 
sarim raza
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry but i cant find any dispose() method, which class has this method, and how can i use this on Joptionpane ?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!