Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Message Box Functionality

 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
How can i get the effect of a message box using Swing. This is for information, Confirmation etc., .
for instance, i would like to display a message " Do you really want to quit the application?" when the user clicks on the 'Exit' button. Depending on ther user response, i either close the window or put him back to the previous state.
Is there any built-in method/class in Swing to get this done. Or do we have to create our own window with buttons and all.
I would appreciate any information in this regard.

thanks
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a JDialog to me.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JOptionPane's show methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic