All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.html.HTMLTable
java.lang.Object
|
+----sdsu.html.HTMLTable
- public class HTMLTable
- extends Object
- implements HTML
Implements an HTML table. This allows displaying of items in rows and columns.
Here is an example of an HTML table with: border size 2, a Caption, centered,
width at 70%, the first row and column set as headers.
The Caption
| Row 0 (zero) is declared | to be |
a header |
Column 0 is a | Cell 1,1 | Cell 1, 2 |
Cell 1, 2 |
header | Cell 1,1 | | |
- Version:
- 0.8 6 April 1997
- Author:
- Roger Whitney (whitney@cs.sdsu.edu)
-
HTMLTable(int, int)
- Create a new table with given number of rows and columns.
-
HTMLTable(Table)
- Create a new html table with element given by the sdsu.util.Table
-
alignCenter()
- Centers the table in the page.
-
alignLeft()
- Left justifies the table.
-
alignRight()
- Right justifies the table.
-
elementAt(int, int)
- Returns the string version of the object in table at given row and column.
-
makeColumnAHeader(int)
- Makes the given column a header for the rows of table.
-
makeRowAHeader(int)
- Makes the given row a header for the columns of table.
-
setBorderWidth(int)
- Sets the width of the border drawn around table and indivitual cells.
-
setCaption(Formatter)
- Sets text caption displayed above the table.
-
setElementAt(HTML, int, int)
- Places string representation of data in table at given row and column
-
setElementAt(Object, int, int)
- Places string representation of data in table at given row and column
-
setWidth(int)
- Suggests a width in pixels of the table.
-
setWidthPercent(int)
- Suggests a width for the table in percent of window width.
-
toString()
-
HTMLTable
public HTMLTable(int numberOfRows,
int numberOfColumns)
- Create a new table with given number of rows and columns. All elements are
set to the empty string.
- Parameters:
- numberOfRows - number of rows in the table
- numberOfColumns - number of colums in the table
HTMLTable
public HTMLTable(Table initialTableElements)
- Create a new html table with element given by the sdsu.util.Table
- Parameters:
- initialTableElements - table containing the initial elements for
the html table
alignCenter
public void alignCenter()
- Centers the table in the page.
Does not affect the alignment of the items
in each table location.
alignRight
public void alignRight()
- Right justifies the table. The right edge of the table will start on the right edge of
the page.
Does not affect the alignment of the items
in each table location.
alignLeft
public void alignLeft()
- Left justifies the table. The Left edge of the table will start on the left edge of
the page. This is the default setting.
Does not affect the alignment of the items
in each table location.
setBorderWidth
public void setBorderWidth(int pixelWidth)
- Sets the width of the border drawn around table and indivitual cells.
default setting is border of one pixel. Pixel size of zero gives no border.
- Parameters:
- pixelWidth - width of border in pixels
setCaption
public void setCaption(Formatter caption)
- Sets text caption displayed above the table.
- Parameters:
- caption - displayed above table
makeRowAHeader
public void makeRowAHeader(int row)
- Makes the given row a header for the columns of table.
Netscape will center and make bold all items on the given row.
- Parameters:
- row - index of the row to be the header
makeColumnAHeader
public void makeColumnAHeader(int column)
- Makes the given column a header for the rows of table.
Netscape will center and make bold all items on the given column.
- Parameters:
- column - index of the column to be the header
setElementAt
public void setElementAt(HTML data,
int row,
int column) throws ArrayIndexOutOfBoundsException
- Places string representation of data in table at given row and column
- Parameters:
- data - HTML object whose string representation is added to the table
- Throws: ArrayIndexOutOfBoundsException
- thrown if
row or column is not a valid index
setElementAt
public void setElementAt(Object data,
int row,
int column) throws ArrayIndexOutOfBoundsException
- Places string representation of data in table at given row and column
- Parameters:
- data - Item whose string representation is added to the table,
special characters are escaped for you
- Throws: ArrayIndexOutOfBoundsException
- thrown if
row or column is not a valid index
setWidth
public void setWidth(int pixelWidth)
- Suggests a width in pixels of the table. Browser will try to use this width.
- Parameters:
- pixelWidth - suggested width of the table in pixels.
setWidthPercent
public void setWidthPercent(int percentOfWindowWidth)
- Suggests a width for the table in percent of window width.
Browser will try to use this width.
- Parameters:
- percentOfWindowWidth - int between 0 and 100
elementAt
public String elementAt(int row,
int column) throws ArrayIndexOutOfBoundsException
- Returns the string version of the object in table at given row and column.
- Throws: ArrayIndexOutOfBoundsException
- thrown if
row or column is not a valid index
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index