All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.strandberg.html.Selection

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

public class Selection
extends Object
implements HTMLItem

The class Selection is used to create HTML Selections in Forms. To create a Selection, inside an HTML form, that looks likes this:

Preferred OS:

You would need HTML code like this:

   Preferred OS:
   <SELECT NAME="prefos">
   <OPTION VALUE="sunos"> Solaris 
   <OPTION VALUE="wnt"> Windows NT 
   <OPTION VALUE="w95"> Windows 95
   </SELECT>
 
which is created by this java code:
   Selection sel = new Selection("prefos", "Preferred OS:", false);
   sel.addOption("sunos", "Solaris");
   sel.addOption("wnt", "Windows NT");
   sel.addOption("w95", "Windows 95");
   String myString = sel.toHTML();
 
If the size of a Selection is set to an integer value greater than 1, it will appear as a list (see below)

Preferred OS:

If the size of a Selection is set to an integer value greater than 1, and the proerty multi is set to true, the Selection will appear as a list where where multiple selections are possible (see below)

Preferred OS:

Comment: This gadget is known by many names. In HTML it is called SELECT or selection, in Java it is called "Choice", in Motif it is called ComboBox etc.

Version:
$Revision: 0.0 $
Author:
Mats Strandberg

Constructor Index

 o Selection(String, String)
Constructs a new Selection with name and label as given by the parameters.
 o Selection(String, String, boolean)
 o Selection(String, String, boolean, int)
 o Selection(String, String, boolean, int, boolean)

Method Index

 o addOption(String, String)
Adds an option as one of the choices in this selection
 o main(String[])
Tests the class
 o toHTML()

Constructors

 o Selection
 public Selection(String name,
                  String label)
Constructs a new Selection with name and label as given by the parameters. the HTML code of this selection will be generated as a table item, .i.e. a table cell.

 o Selection
 public Selection(String name,
                  String label,
                  boolean asTableItem)
 o Selection
 public Selection(String name,
                  String label,
                  boolean asTableItem,
                  int size)
 o Selection
 public Selection(String name,
                  String label,
                  boolean asTableItem,
                  int size,
                  boolean multi)

Methods

 o addOption
 public void addOption(String name,
                       String label)
Adds an option as one of the choices in this selection

 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