Input Dialogs
Line 3 imports class JOptionPane
. Lines 10–11 declare the local String
variable firstNumber
and assign it the result of the call to JOptionPane static
method showInputDialog. This method displays an input dialog (see the screen capture in Fig. 12.2(a)), using the method’s String
argument ("Enter first integer"
) as a prompt.
Look-and-Feel Observation 12.2
The prompt in an input dialog typically uses sentence-style capitalization—a style that capitalizes only the first letter of the first word in the text unless the word is a proper noun (for example, Jones).
The user types characters in the text field, then clicks OK or presses ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.