All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.strandberg.html.Checkbox

java.lang.Object
   |
   +----net.strandberg.html.Checkbox

public class Checkbox
extends Object
implements HTMLItem

The class Checkbox is used to create HTML checkboxes to be used in Forms. To create a checkbox, inside an HTML form, that looks like this:

Generate as HTML

you would need HTML code like this:

   <INPUT TYPE="checkbox" NAME="asHTML" VALUE="Yes">Generate as HTML
 
which is created by this Java code:
   Checkbox cb = new Checkbox("asHTML", "Generate as HTML", "Yes", false);
   String myString = cb.toHTML();
 

Version:
$Revision: 0.0 $
Author:
Mats Strandberg
See Also:
Form

Constructor Index

 o Checkbox(String, String)
Constructs a checkbox with a label.
 o Checkbox(String, String, String)
Constructs a checkbox with a label.
 o Checkbox(String, String, String, boolean)
Constructs a checkbox with a label.

Method Index

 o main(String[])
Tests the class
 o putLabelLeftOfBox()
Aligns the label to the left of the checkbox.
 o toHTML()

Constructors

 o Checkbox
 public Checkbox(String name,
                 String label,
                 String value)
Constructs a checkbox with a label. The label will by default be placed to the right of the checkbox. The HTML code for this checkbox will be generated as a table item, i.e. a table cell.

Parameters:
name - the name of this checkbox in the form
label - the text presented next to the checkbox
value - the value that the name of this checkbox in a form will be assigned to when box is ticked will be "Y".
 o Checkbox
 public Checkbox(String name,
                 String label,
                 String value,
                 boolean asTableItem)
Constructs a checkbox with a label. The label will by default be placed to the right of the checkbox. The HTML code for this checkbox will be generated as a table item, i.e. a table cell.

Parameters:
name - the name of this checkbox in the form
label - the text presented next to the checkbox
value - the value that the name of this checkbox in a form will be assigned to when box is ticked.
asTableItem - if true the HTML code for this checkbox will be generated as a table item, i.e. a table cell
 o Checkbox
 public Checkbox(String name,
                 String label)
Constructs a checkbox with a label. The label will by default be placed to the right of the checkbox. The HTML code for this checkbox will be generated as a table item, i.e. a table cell. The value that the name of this checkbox in a form will be assigned to when box is ticked will be "Yes".

Parameters:
name - the name of this checkbox in the form
label - the text presented next to the checkbox

Methods

 o putLabelLeftOfBox
 public void putLabelLeftOfBox()
Aligns the label to the left of the checkbox. (The label is by default right of the checkbox).

 o toHTML
 public String toHTML()
 o main
 public static void main(String args[])
Tests the class


All Packages  Class Hierarchy  This Package  Previous  Next  Index