Postcard

MessageDialog, QuestionDialog, and YesNoDialog all extend WorkDialog, and all provide the means to add not only text to the dialog, but an image as well. Figure 22-2 shows instances of MessageDialog, QuestionDialog, and YesNoDialog doing their thing.

Figure 22-2. Message, Question, and Yes/No Dialogs Message, question, and yes/no dialogs can be fitted with an image and a panel.

Naturally, we don't want to reimplement the code for placing an image next to a panel in each dialog class, so that functionality is embedded in the Postcard class, which is listed in Example 22-4.

Example 22-4. Postcard Class Listing
 import java.awt.*; public ...

Get Graphic Java™ 1.2, Volume I: AWT, Third 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.