Section 12.3 Simple GUI-Based Input/Output with JOptionPane

• Most applications use windows or dialog boxes (p. 476) to interact with the user.

• Class JOptionPane (p. 476) of package javax.swing (p. 474) provides prebuilt dialog boxes for both input and output. JOptionPane static method showInputDialog (p. 477) displays an input dialog (p. 476).

• A prompt typically uses sentence-style capitalization—capitalizing only the first letter of the first word in the text unless the word is a proper noun.

• An input dialog can input only input Strings. This is typical of most GUI components.

JOptionPane static method showMessageDialog (p. 478) displays a message dialog (p. 476).

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.