layout.setRowWeight(widgets.size() * 2, 1);
layout.setColumnWeight(3, 1);
panel.setLayout(layout);
for (int i = 0; i < widgets.size(); i++) {
Widget widget = (Widget) widgets.get(i);
if (widget instanceof LabeledWidget) {
LabeledWidget lw = (LabeledWidget) widget;
if (lw.getDataWidget().getWidget().getPreferredSize().height > DEFAULT_HEIGHT) {
panel.add(lw.getLabel().getWidget(), constraints.rc(i * 2 + 1, 1, "rlt"));
} else {
panel.add(lw.getLabel().getWidget(), constraints.rc(i * 2 + 1, 1));
}
panel.add(lw.getDataWidget().getWidget(), constraints.rc(i * 2 + 1, 3));
} else if (widget instanceof Separator) {
panel.add(widget.getWidget(), constraints.rcwh(i * 2 + 1, 1, 3, 1));
} else {
panel.add(widget.getWidget(), constraints.rc(i * 2 + 1, 3, "rtb"));
}
}
if (buttons.size() > 0) {
JPanel buttonLayout = new JPanel();
buttonLayout.setLayout(new BoxLayout(buttonLayout, BoxLayout.X_AXIS));