package common.components.form; import java.awt.Component; import javax.swing.JLabel; /** * The form component class is used within forms * * It requires a JLabel label and a Component Field * * @author Daniel */ public class FormComponent { private JLabel label; private Component field; private boolean layoutVertical = false; /** * Creates a new form component to be added to a form * * @param label the JLabel for the label * @param field the Component on the right side */ public FormComponent(JLabel label, Component field) { this.label = label; this.field = field; } /** * Creates a new form component to be added to a form * * @param label The string for the label to display * @param field The Component on the right side */ public FormComponent(String label, Component field) { this.label = new JLabel(label); this.field = field; } /** * Creates a new form component that will be layed out vertically * * @param label */ public FormComponent(String label, Component field, boolean vertical) { this.label = new JLabel(label); this.field = field; this.layoutVertical = vertical; } public void setLabel(JLabel label) { this.label = label; } public JLabel getLabel() { return this.label; } public void setField(Component field) { this.field = field; } public Component getField() { return this.field; } public boolean getVertLayout() { return layoutVertical; } public void setVertLayout(boolean value) { this.layoutVertical = value; } }