Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Speed up your Swing GUI construction with better building blocks

Use two helper classes to reduce dialog development time

  • Print
  • Feedback

Page 5 of 8

A common dialog

The purpose of the class StandardDialog is to hold a data entry panel (such as a LabelledItemPanel), provide the standard Ok and Cancel buttons, and handle basic processing when the Ok or Cancel buttons are pressed.

The StandardDialog is modal, so a call to the show() method is a blocking call. After calling the show() method, the hasUserCancelled() method should be called to see if the user has cancelled the dialog by either pressing the Cancel button or the dialog close button (on the dialog frame).

StandardDialog can be used in two ways:

  • Create an instance of StandardDialog and add a data entry panel to the dialog
  • Subclass StandardDialog and add a data entry panel to the dialog during construction


An example of using StandardDialog directly is shown in the following code fragment:

  • Print
  • Feedback

Resources