Recently in doing school curriculum design, Java programming needs to use the dialog box pop-up, the first response is JS in the alert and confirm,java words of the moment Meng, consulting learning summarized as follows, for later learning
1. Displays an error dialog box that displays the message ' Alert ':
Joptionpane.showmessagedialog (NULL, "Alert", "alert", joptionpane.error_message);
2. displays an internal Information dialog box with the message ' Information ':
Joptionpane.showinternalmessagedialog (frame, "information", "Information", joptionpane.information_message);
3. Display an information panel with the options "yes/no" and the message "Choose one":
Joptionpane.showconfirmdialog (NULL, "Choose one", "Choose One", joptionpane.yes_no_option);
4. Display an Internal Information dialog box with the options "Yes/no/cancel", the message is ' please choose one ' and has the title information:
Joptionpane.showinternalconfirmdialog (frame,
"Please choose one", "Information",
Joptionpane.yes_no_ Cancel_option,
joptionpane.information_message);
5. Display a warning dialog box, its options are OK, Cancel,title is ' Warning ', message is ' Click OK to continue ':
object[] options = {"OK", "Cancel"};
Joptionpane.showoptiondialog (NULL, "Click OK to continue", "Warning",
joptionpane.default_option, Joptionpane.warning_message,
null, Options, options[0]);
6. Displays a dialog box that requires the user to type a String:
String Inputvalue = joptionpane.showinputdialog ("Please input a value");
7. displays a dialog box that requires the user to select String:
Object[] PossibleValues = {"A", "Second", "Third"};
Object SelectedValue = Joptionpane.showinputdialog (null, "Choose One", "Input",
joptionpane.information_message, NULL,
PossibleValues, possiblevalues[0]);
The above is a small series for you to bring the Java dialog box pop-up method all content, I hope that we support cloud Habitat Community ~