All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.strandberg.html.RadioButtonSet

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

public class RadioButtonSet
extends Object
implements HTMLItem

The class RadioButtonSet is used to create a set of HTML radio buttons to be used in Forms. The set of radio buttons are physically connected so that selecting one button in the set automatically de-selects the previously selected button. All radio buttons in one RadioButtonSet must have the same in the NAME tag, that's what makes a number of radio buttons connected, i.e. gives the buttons their "radio button" property. To create a radio button set, inside an HTML form, that looks like this:

Radio buttons: Radio 1 Radio 2 Radio 3

you would need HTML code like this:

   Radio buttons: 
   <INPUT TYPE="radio" NAME="myRadio" VALUE="radio1">Radio 1
   <INPUT TYPE="radio" NAME="myRadio" VALUE="radio2">Radio 2
   <INPUT TYPE="radio" NAME="myRadio" VALUE="radio3">Radio 3
 
which is created by this Java code:
   RadioButtonSet rbs = new RadioButtonSet("myRadio", "Radio buttons:", false);
   rbs.addRadioButton("radio1", "Radio 1");
   rbs.addRadioButton("radio2", "Radio 2");
   rbs.addRadioButton("radio3", "Radio 3");
   String myString = rbs.toHTML();
 

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

Constructor Index

 o RadioButtonSet(String)
Constructs a radio button set with no label.
 o RadioButtonSet(String, String)
Constructs a radio button set with a label.
 o RadioButtonSet(String, String, boolean)
Constructs a radio button set with a label.

Method Index

 o addRadioButton(String, String)
Adds a radio button to this set.
 o main(String[])
Tests the class
 o makeLayoutVertical()
Makes the layout of the radio buttons vertical.
 o toHTML()

Constructors

 o RadioButtonSet
 public RadioButtonSet(String name)
Constructs a radio button set with no label. The HTML code for this radio button set will be generated as table items, i.e. as table cells. The layout is horizontal.

Parameters:
name - the name of these radio buttons in the form
 o RadioButtonSet
 public RadioButtonSet(String name,
                       String label)
Constructs a radio button set with a label. The HTML code for this radio button set will be generated as table items, i.e. as table cells. The layout is horizontal.

Parameters:
name - the name of these radio buttons in the form
label - the text presented left of the radio button set
 o RadioButtonSet
 public RadioButtonSet(String name,
                       String label,
                       boolean asTableItems)
Constructs a radio button set with a label. The layout is horizontal.

Parameters:
name - the name of these radio buttons in the form
label - the text presented left of the radio button set
asTableItems - if true the HTML code for this checkbox set will be generated as table items, i.e. as table cells

Methods

 o makeLayoutVertical
 public void makeLayoutVertical()
Makes the layout of the radio buttons vertical. (The layout is by default horizontal).

 o addRadioButton
 public void addRadioButton(String value,
                            String label)
Adds a radio button to this set. Its HTML code will be generated as a table cell if this radio button set is generated as table cells. The added radio button will get its label to the right of the button.

Parameters:
value - the value to be given to this radio button set when this button is selected
label - the text presented next to this radio button
 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