Java Reference
In-Depth Information
EXAMPLE 3-9
The output of the statement:
JOptionPane.showMessageDialog( null , "Hello World!", "Greetings",
JOptionPane.INFORMATION_MESSAGE);
is shown in Figure 3-9.
boxTitleString
messageStringExpression
messageType(Here it is, the
INFORMATION_MESSAGE icon)
FIGURE 3-9 Message dialog box showing its various components
Notice the INFORMATION_MESSAGE icon to the left of Hello World! and the word
Greetings in the title bar. After you click the OK button, the dialog box disappears.
EXAMPLE 3-10
Figure 3-10 shows the output of the following statement:
JOptionPane.showMessageDialog( null , "Amount Due = $" + 500.45,
"Invoice", JOptionPane.PLAIN_MESSAGE);
FIGURE 3-10 Message box with no icon
In the message dialog box in Figure 3-10, no icon appears
to the left of
the
messageStringExpression . This
is because the messageType is JOptionPane.
PLAIN_MESSAGE .
 
Search WWH ::




Custom Search