Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane - how to make custom buttons close the JOptionPane  RSS feed

 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I have a JOptionPane that is made using the JOptionPane.showOptionDialog(...) method. In this I have custom buttons that I have passed in at the Object[]. The buttons have actionListeners and I can capture when the user clicks these buttons.

My question is, how do I programatically hide or get rid of the JOptionPane once the user has clicked on a button?

Thanks,
Rachel
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will give that a try.

Does this mean that the only way I can do this is to use the JOptionPane constructor and put it on the JDialog? Is there no way to do this with the static show methods?

Cheers,
Rachel
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!