Summary
The JOptionPane class provides a rich set of predefined dialog boxes. The static showXXXDialog methods provide one-line methods for displaying many common dialog boxes. To further simplify application code, the dialog boxes block, enabling the calling code to process the users response in the code immediately following the showXXXDialog method used to display the dialog box.
In this chapter you have seen how to display message dialog boxes. The message type parameter allows the dialog to convey different levels of severity in the message. You also saw how to query the user for one-line of textual input. The JOptionPane class can be configured to present a set of choices to the user. The dialog box blocks until an option is selected or the user closes the dialog box. You also saw how to extend the JOptionPane class to create an action-aware dialog box.
There are internal versions of each of the pre-defined dialog boxes contained in the JOptionPane class. These dialog boxes are contained in its parent frame and do not extend beyond it. Unfortunately, the internal versions of these dialog boxes are of inferior quality and not usable at this time.
The predefined dialog boxes will suffice for many simple, and not so simple, dialog boxes. However, if one of the predefined dialog boxes doesnt meet your needs, the JOptionPane class also provides for almost unlimited
|