public class FormPanel
extends java.lang.Object
Sets up a panel with a form layout. It has the standard 2-column form layout, a column of labels and a column of controls, with the option of adding rows that span both columns.
Call addRow(JComponent, JComponent) to add a label and control pair, and addRow(JComponent) to add a row that spans both columns. The rows are displayed in the order they are added. Call getPanel() to get the root panel.
This implementation uses GroupLayout, which has a couple of nice properties: the components are vertically aligned along their baseline, which makes the left-to-right flow look better, and they are spaced according to the look-and-feel defaults, which makes the form look more like a native form.
| Constructor and Description |
|---|
FormPanel() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRow(javax.swing.JComponent control) |
void |
addRow(javax.swing.JComponent label,
javax.swing.JComponent control) |
void |
addRow(javax.swing.JComponent field,
javax.swing.JComponent label,
javax.swing.JComponent component2,
javax.swing.JComponent control) |
javax.swing.JPanel |
getPanel() |
public void addRow(javax.swing.JComponent field,
javax.swing.JComponent label,
javax.swing.JComponent component2,
javax.swing.JComponent control)
public void addRow(javax.swing.JComponent label,
javax.swing.JComponent control)
public void addRow(javax.swing.JComponent control)
public javax.swing.JPanel getPanel()