A Dialog window is showinputdailog independent subwindow meant to carry temporary notice apart from the main Swing Application Window. Most Dialogs present an error message or warning to a user, but Dialogs can present images, directory trees, or just about anything compatible with the main Swing Application that manages them.For syntax of joptionpane showinputdialog cancel, several Swing component classes can directly instantiate and display dialogs. To create simple, standard dialogs, you use theJOptionPane class.
The ProgressMonitor class can put up a dialog that shows the progress of an operation. Two other classes, JColorChooser and JFileChooser, also supply standard dialogs. To bring up a print dialog, you can use thePrinting API. To create a custom dialog, use theJDialog class directly.The code for simple dialogs can be minimal. For example, here is an informational dialog:Here is the code that creates and shows it.
IntroductionThe class JOptionPane is a component which shlwinputdialog standard methods to pop up a standard dialog box for a value or informs the user showinputdialot something. However, sometimes you just need a plain old, nothing fancy, quick-and-dirty, keep it simple dialog. In these situations, the JOptionPane works really well. It helps to understand those limitations such that it fulfills your expectations.
The first limitation (some consider this a feature) is modality. The thread which creates the JOPtionPane dialog will wait until the user closes the dialog. The other limitation is that it cannot be resized. JOptionPane.showInputDialog() will return the string the user has entered if the user hits ok, and returns null otherwise. Therefore, you can just check to see if the resultant string is null.
The javadocs on the method here are not terribly explicit about this, but where the return behavior is mentioned, it is indicated to be so.