> > (shakes head slowly) I do not quite
> > follow the layout you mean.
[quoted text clipped - 20 lines]
>
> Laird
Yep. Mostly in my programs (I used to make GUI's in Delphi), there is a
several labels (or various input area's), and on the button, there are
few buttons. Using existing Layout managers, I must use at least two,
one for top area and one for bottom (probably FlowLayout for buttons).
I have seen JFC Visual Swing examples, but are very basic. Let's say I
have such GUI:
+--------------------------------------+
| Enter phone: __________ +
| Enter name: ___________ +
|--------------------------------------+
| +-------+ +-------+ +--------+ |
| | Ok | | Apply | | Cancel | |
| +-------+ +-------+ +--------+ |
+--------------------------------------+
What would be the most convenient way using Layout managers to do it ?
Karsten Lentzsch - 10 Mar 2004 11:58 GMT
> +--------------------------------------+
> | Enter phone: __________ +
[quoted text clipped - 6 lines]
>
> What would be the most convenient way using Layout managers to do it ?
In this case I would use two layouts: one for
the labels, field, and a button bar, and a
sublayout for the buttons in the button bar.
I recommend to use a single grid if it helps
align components. In the above design you don't
align the buttons with the labels or fields.
Extracting a sublayout makes the main layout simpler.
In Forms you can write the above as:
FormLayout layout = new FormLayout("pref, 3dlu, pref");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.append("Enter phone:", phoneField);
builder.append("Enter name:", nameField);
builder.append(ButtonBarFactory.buildOKCancelApplyBar(...), 3);
return builder.getPanel();
I recommend to use "Phone:" instead of "Enter phone:".
Regards,
Karsten