Four types of information balloon in Java
tags (space-delimited): Java
Four ways to eject a pop-up balloon in Java:
confirmdialog-Confirmation dialog box, the user clicks "YES" or "No"
inputdialog-Enter a cue box
messagedialog-Information Balloon
optiondialog-combination of the remaining three frame bodies
Example:
Confirmdialog:
Joptionpane.showconfirmdialog (New JFrame (). Getcontentpane (),
"User name is registered. "," System Information ", Joptionpane.yes_no_option, Joptionpane.question_message);
According to the different choice have joptionpane.yes_option, joptionpane.no_option, Joptionpane.cancel_option, Joptionpane.closed_ Option four cases (or other exceptions)
Inputdialog:
Situation One:
Object[] PossibleValues = {"A", "Second", "third"}; User's Select item
Object SelectedValue = Joptionpane.showinputdialog (null, "Choose One", "Input", joptionpane.information_message, NULL, PossibleValues, Possiblevalues[0]);
Situation Two:
String str= joptionpane.showinputdialog ("Please enter");
Messagedialog:
Joptionpane.showmessagedialog (New JFrame (). Getcontentpane (),
"User name does not exist or the password is wrong!\n please re-enter." "," System Information ", joptionpane.information_message);
Joptionpane.showmessagedialog (New JFrame (). Getcontentpane (),
"User name does not exist or the password is wrong!\n please re-enter." "," System Information ", joptionpane.warning_message);
Joptionpane.showmessagedialog (New JFrame (). Getcontentpane (),
"User name does not exist or the password is wrong!\n please re-enter." "," System Information ", joptionpane.error_message);
Joptionpane.showmessagedialog (New JFrame (). Getcontentpane (),
"User name does not exist or the password is wrong!\n please re-enter." "," System Information ", joptionpane.question_message);
Optiondialog:
object[] options = {"1", "2", "3", "4"};//user can define the number of buttons here
Joptionpane.showoptiondialog (NULL, "Select button, number can set", "Options dialog box title", Joptionpane.yes_option,joptionpane.question_message, NULL, Options, options[0]);