All Packages Class Hierarchy This Package Previous Next Index
Class net.strandberg.html.CheckboxSet
java.lang.Object
|
+----net.strandberg.html.CheckboxSet
- public class CheckboxSet
- extends Object
- implements HTMLItem
The class CheckboxSet is used to create a set of HTML checkboxes
to be used in Forms. The set of checkboxes are not physically connected in
any way. A set of checkboxes is only used for layout reasons.
To create a checkbox set, inside an HTML form, that looks
like this:
you would need HTML code like this:
Checkboxes:
<INPUT TYPE="checkbox" NAME="cb1" VALUE="Y">Checkbox 1
<INPUT TYPE="checkbox" NAME="cb2" VALUE="Y">Checkbox 2
<INPUT TYPE="checkbox" NAME="cb3" VALUE="Y">Checkbox 3
which is created by this Java code:
CheckboxSet cbs = new CheckboxSet("Checkboxes:", false);
cbs.addCheckbox("cb1", "Checkbox 1");
cbs.addCheckbox("cb2", "Checkbox 2");
cbs.addCheckbox("cb3", "Checkbox 3");
String myString = cbs.toHTML();
- Version:
- $Revision: 0.0 $
- Author:
- Mats Strandberg
- See Also:
- Form
-
CheckboxSet()
- Constructs a checkbox set with no label.
-
CheckboxSet(String)
- Constructs a checkbox set with a label.
-
CheckboxSet(String, boolean)
- Constructs a checkbox set with a label.
-
add(Checkbox)
- Adds a Checkbox to this set.
-
addCheckbox(String, String)
- Adds a Checkbox to this set.
-
main(String[])
- Tests the class
-
makeLayoutVertical()
- Makes the layout of the checkboxes vertical.
-
toHTML()
-
CheckboxSet
public CheckboxSet()
- Constructs a checkbox set with no label. The HTML code for this checkbox set
will be generated as table items, i.e. as table cells. The layout is horizontal.
CheckboxSet
public CheckboxSet(String label)
- Constructs a checkbox set with a label. The label will be placed to the
left of the checkboxes. The HTML code for this checkbox set will be generated as
table items, i.e. as table cells. The layout is horizontal.
- Parameters:
- label - the text presented left of the checkbox set
CheckboxSet
public CheckboxSet(String label,
boolean asTableItems)
- Constructs a checkbox set with a label. The label will be placed to the
left of the checkboxes. The layout is horizontal.
- Parameters:
- label - the text presented left of the checkbox set
- asTableItems - if true the HTML code for this checkbox set will be generated as
table items, i.e. as table cells
makeLayoutVertical
public void makeLayoutVertical()
- Makes the layout of the checkboxes vertical. (The layout is by default horizontal).
addCheckbox
public void addCheckbox(String name,
String label)
- Adds a Checkbox to this set. The added checkbox will have the value
"Y" assigned to it when it is ticked. Its HTML code will be generated as a
table cell if this checkbox set is generated as table cells.
The added checkbox will get its label to the right of the box.
- Parameters:
- name - the name of this checkbox in the form
- label - the text presented next to the checkbox
add
public void add(Checkbox cb)
- Adds a Checkbox to this set.
- Parameters:
- cb - the checkbox to add
toHTML
public String toHTML()
main
public static void main(String args[])
- Tests the class
All Packages Class Hierarchy This Package Previous Next Index