File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Messasge Box Functionality Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Messasge Box Functionality" Watch "Messasge Box Functionality" New topic
Author

Messasge Box Functionality

Ajit Kumar
Ranch Hand

Joined: Jan 27, 2001
Posts: 81
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

Joined: Sep 29, 2000
Posts: 8521
You can use a JDialog with the question as the title. You do have to add your own yes/No buttons and listen to them and decide what to do.
Or you can use a JOptionPane with the showConfirmDialog.

[This message has been edited by Cindy Glass (edited January 28, 2001).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Messasge Box Functionality