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,1Cell 1, 2 Cell 1, 2
headerCell 1,1  


Version:
0.8 6 April 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Index

 o HTMLTable(int, int)
Create a new table with given number of rows and columns.
 o HTMLTable(Table)
Create a new html table with element given by the sdsu.util.Table

Method Index

 o alignCenter()
Centers the table in the page.
 o alignLeft()
Left justifies the table.
 o alignRight()
Right justifies the table.
 o elementAt(int, int)
Returns the string version of the object in table at given row and column.
 o makeColumnAHeader(int)
Makes the given column a header for the rows of table.
 o makeRowAHeader(int)
Makes the given row a header for the columns of table.
 o setBorderWidth(int)
Sets the width of the border drawn around table and indivitual cells.
 o setCaption(Formatter)
Sets text caption displayed above the table.
 o setElementAt(HTML, int, int)
Places string representation of data in table at given row and column
 o setElementAt(Object, int, int)
Places string representation of data in table at given row and column
 o setWidth(int)
Suggests a width in pixels of the table.
 o setWidthPercent(int)
Suggests a width for the table in percent of window width.
 o toString()

Constructors

 o 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
 o 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

Methods

 o alignCenter
 public void alignCenter()
Centers the table in the page. Does not affect the alignment of the items in each table location.

 o 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.

 o 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.

 o 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
 o setCaption
 public void setCaption(Formatter caption)
Sets text caption displayed above the table.

Parameters:
caption - displayed above table
 o 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
 o 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
 o 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
 o 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
 o 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.
 o 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
 o 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
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index