An error dialog box is displayed, the message 'alert':
JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);
Internal information display box contains "Information" message:
JOptionPane.showInternalMessageDialog(frame, "information",
"information", JOptionPane.INFORMATION_MESSAGE);
Note that this is an internal box, you can not drag out the layout of the parent
Display option Yes / No and the message "Select a panel of information:
JOptionPane.showConfirmDialog(null,
"choose one", "choose one", JOptionPane.YES_NO_OPTION);
This method can return int, if you click yes, returns 0, click No, it returns 1, in order to define the user's choice
Display internal information dialog box with options Yes / No / Cancel, and "Please select a" and title information:
JOptionPane.showInternalConfirmDialog(frame,
"please choose one", "information",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
It is also only a drag in the panel or dialog box jframe
Displays a warning dialog box that contains options OK, CANCEL, the title 'Warning' and the message '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]);
Display a dialog box asking the user to enter a string:
String inputValue = JOptionPane.showInputDialog("Please input a value");
Display a dialog box asking the user to select a character string:
Object[] possibleValues = { "First", "Second", "Third" };
Object selectedValue = JOptionPane.showInputDialog(null,
"Choose one", "Input",
JOptionPane.INFORMATION_MESSAGE, null,
possibleValues, possibleValues[0]);
reference
JDK1.6 Chinese Documents