Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
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
Page 2 of 8
We determined the following three elements were common to most of our dialogs:
The differences between screens were the actual fields being edited and their labels.
The most tedious part of developing the dialogs was specifying the layout constraints for each field and its label. The fastest
way to develop is for the classes to allow us to specify the fields and their labels without specifying the layout constraints.
It seemed to make sense to use two different classes: one for handling layout of the labelled fields and one for the common
dialog buttons and associated processing. We called the class for layout handling LabelledItemPanel, while we called the class for the common dialog features StandardDialog.
The purpose of LabelledItemPanel is to lay out items and their labels neatly on a panel. The class uses a GridBagLayout to control the actual layout, but this is all hidden from class users. To use the class, the item and its label are added
to the panel with the addItem() method, passing the text for the field label and the field component. The user does not have to specify any layout constraints
because the class works out all of the layout constraints needed.
The LabelledItemPanel can be used in two ways:
LabelledItemPanel and add data entry fields to the panel
LabelledItemPanel and add the data entry fields to the panel during construction
An example of using LabelledItemPanel directly is shown in the following code fragment: