Java Reference
In-Depth Information
Table 9-2.
JOptionPane Static create and show Methods (Continued)
Icon
Icon
Options
Object[ ]
Initial Value
Object
Selection Values
Object[ ]
Initial Selection
Object
3
3
4
4
4
4
456
3
3
3
1
1
1
1
1
1
■
Note
When the parent component argument is
null
, a hidden frame is used and the pop-up is centered
on the screen. See the
getSharedOwnerFrame()
method of
SwingUtilities
for more details on the
hidden frame. There are other focus-related usability issues that you might run into when specifying
null
as
a parent component, if the hidden frame and dialog box are swapped to the background.
Message Pop-Ups
The
showMessageDialog()
and
showInternalMessageDialog()
methods create an
INFORMATION_MESSAGE
pop-up with the pop-up title “Message,” unless different argument
settings are specified for the message type and window title. Because the sole purpose of the
message dialog box is to display a message, these dialog boxes provide only an OK button and
return no value. Figure 9-3 shows sample message pop-ups created from the following lines
of source:
JOptionPane.showMessageDialog(parent, "Printing complete");
JOptionPane.showInternalMessageDialog(desktop, "Printing complete");