• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please suggest me some swing component which should close automatically  RSS feed

 
Sri Palem
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After clicking on a button it should get a popup window which has some text in it and after 2-3 secs it should close automatically. It should not contain any buttons in it. kindly suggest me some swing component which satisfies these requirements. I tried JPopup, but i cannot close it automatically. So it is not satisfying my requirement.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sravanthi Macharla wrote: I tried JPopup, but i cannot close it automatically. So it is not satisfying my requirement.


JPopupMenu#setVisible(false) will hide the popup.
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you can use a javax.swing.Timer to call that line of code after 3 seconds.
 
Rob Camick
Ranch Hand
Posts: 2801
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing that will close automatically.

You need to use a Swing Timer to schedule the closing of the component. When the Timer fires you invoke the appropriate method to close the component.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!