Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class COM.Subrahmanyam.table.Table

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----java.awt.Panel
                            |
                            +----COM.Subrahmanyam.table.Table

public class Table
extends java.awt.Panel
implements java.awt.ItemSelectable
Class Table is a multicolumn version of the JDK class List that provides an interface to tabular string data (in a number of rows and columns). This class extends the Panel class and contains three components: a header to display column titles, a data area to display rows and columns of data, and a scrollbar (when necessary) as shown below.

Table Widget

Each column has a title displayed in the header at the top. The vertical scrollbar is displayed on the right.

Features

Events

Table widget employs JDK 1.1 compliant delegation-event model for event handling.

Single-click mode

In this mode single mouse-click over an item causes an ACTION_EVENT event. Moving mouse over an item causes SELECT_LIST event. However multiple selections are not allowed in this mode.

Double-click mode

In this mode double mouse-click over an item causes an ACTION_EVENT event while single mouse-clicks cause LIST_SELECT/LIST_DESELECT events. Multiple selections can be made by selecting different elements. The behavior is similar to that of the List component.

Version:
1.0
Author:
Subrahmanyam Allamaraju (subrahmanyam@geocities.com)

Field Summary
static int  DOUBLE_CLICK
Selection by double mouse-click.
static int  HILITE_COLUMN
Hilite columns when selected.
static int  HILITE_ELEMENT
Hilite elements when selected.
static int  HILITE_ROW
Hitile rows when selected.
static int  OUT_OF_FOCUS
Indicates that no row/column is in focus.
static int  SINGLE_CLICK
Selection by single mouse-click.
 
Fields inherited from class java.awt.Component
 BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 

Constructor Summary
 Table()
Constructs an empty Table.
 Table(boolean multipleSelection)
Constructs an empty Table with some properties.
 Table(boolean multipleSelection, int clickMode)
Constructs an empty Table with some properties.
 

Method Summary
void  addActionListener(java.awt.event.ActionListener actionListener)
Add a listener to recieve action events when the state of an item changes.
void  addColumn(java.lang.String title, java.lang.String[] data)
Add a column of data to the table.
void  addColumn(int column, java.lang.String title, java.lang.String[] data)
Add a column of data at the specified position.
void  addItemListener(java.awt.event.ItemListener itemListener)
Add a listener to recieve item events when an element state changes.
void  addMouseListener(java.awt.event.MouseListener mouseListener)
Add a listener to receive mouse events.
void  addMouseMotionListener(java.awt.event.MouseMotionListener mouseMotionListener)
Add a listener to receive mouse motion events.
void  addRow(java.lang.String[] s)
Adds a row of data at the end.
void  addRow(int r, java.lang.String[] s)
Adds a row of data.
void  allowDrag(boolean allowDrag)
Allows/disallows column resize via mouse drag. Deprecated
void  allowMultipleSelections(boolean allowMultipleSelections)
Allows/disallows multiple selections.
void  clear()
Clears the data in the table.
void  clearAll()
Clears the data and the header as well.
java.lang.String[]  deleteColumn(int c)
Delete a specified column of data.
java.lang.String[]  deleteRow(int r)
Deletes a specified row of data.
int  getBottomRowIndex()
Gets the index of the row at the top of the visible area.
int  getClickMode()
Gets the current click-mode (one of SINGLE_CLICK and DOUBLE_CLICK)
java.lang.String  getElement(int row, int column)
Returns the elemenent at [row, column].
java.awt.Font[]  getFonts()
Gets the current fonts.
int  getHiliteMode()
Gets the current hilite mode.
int  getNoColumns()
Returns the number of columns.
int  getNoRows()
Returns the number of rows.
int  getPageHeight()
Gets the page height.
int[]  getScale()
Returns the current scale-factors of columns.
int  getSelColumnIndex()
Returns index of the selected column.
java.lang.Object[]  getSelectedObjects()
Get selected objects.
TElement[]  getSelection()
Returns an array of TElement objects. Deprecated
int  getSelRowIndex()
Returns index of the currently selected row.
int  getTopRowIndex()
Gets the index of the row at the bottom of the visible area.
boolean  isElementSelected(int row, int col)
Determines if an element specified by row and column indices is selected.
boolean  isEnabled()
Determines whether the Table is currently enabled or disabled.
void  processComponentEvent(java.awt.event.ComponentEvent ce)
Component event handler.
void  removeActionListener(java.awt.event.ActionListener actionListener)
Remove the specified action listener.
void  removeItemListener(java.awt.event.ItemListener itemListener)
Removes the specified item listener.
void  removeMouseListener(java.awt.event.MouseListener ml)
Removes the specified mouse listener.
void  removeMouseMotionListener(java.awt.event.MouseMotionListener ml)
Removes the specified mouse motion listener.
void  repaint()
Repaints the Table.
void  selectColumn(int col)
Selects a column.
void  selectRow(int row)
Selects a row.
void  setClickMode(int m)
Sets the selection mode.
void  setColors(java.awt.Color headFG, java.awt.Color headBG, java.awt.Color dataFG, java.awt.Color dataBG, java.awt.Color revDataFG, java.awt.Color revDataBG)
Sets colors for the header, data (normal and reverse) and the drag line.
void  setColors(int row, int col, java.awt.Color dataFG, java.awt.Color dataBG, java.awt.Color revDataFG, java.awt.Color revDataBG)
Sets colors of a data item.
void  setColumnColors(int col, java.awt.Color dataFG, java.awt.Color dataBG, java.awt.Color revDataFG, java.awt.Color revDataBG)
Sets colors of a column.
void  setElement(int row, int column, java.lang.String s)
Sets the elemenent at [row, column] to the specified string.
void  setElement(TElement element)
Sets the element specified by a TElement object.
void  setEnabled(boolean b)
Enables/disables the Table widget.
void  setFonts(java.awt.Font fh, java.awt.Font fd)
Sets the fonts.
void  setHiliteMode(int m)
Sets the hilite mode.
void  setLineSpacing(double lineSpacing)
Sets the inter-row spacing.
void  setRowColors(int row, java.awt.Color dataFG, java.awt.Color dataBG, java.awt.Color revDataFG, java.awt.Color revDataBG)
Sets colors of a row.
void  setScale(int[] scaleArr)
Sets scale-factors for all the columns.
void  setSize(int width, int height)
Resizes the Table to the specified width and height.
void  showHorizontalSeparator(boolean s)
Shows/hides row separators.
void  showVerticalSeparator(boolean s)
Shows/hides column separators.
 
Methods inherited from class java.awt.Panel
 addNotify
 
Methods inherited from class java.awt.Container
 add, add, add, add, add, addContainerListener, addImpl, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
 action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HILITE_ROW

public static final int HILITE_ROW
Hitile rows when selected.
See Also:
setHiliteMode(int)

HILITE_COLUMN

public static final int HILITE_COLUMN
Hilite columns when selected.
See Also:
setHiliteMode(int)

HILITE_ELEMENT

public static final int HILITE_ELEMENT
Hilite elements when selected.
See Also:
setHiliteMode(int)

SINGLE_CLICK

public static final int SINGLE_CLICK
Selection by single mouse-click.
See Also:
DOUBLE_CLICK, getClickMode, setClickMode(int)

DOUBLE_CLICK

public static final int DOUBLE_CLICK
Selection by double mouse-click.
See Also:
SINGLE_CLICK, getClickMode, setClickMode(int)

OUT_OF_FOCUS

public static final int OUT_OF_FOCUS
Indicates that no row/column is in focus. A row/column attains focus by programmatic or user selection.
See Also:
getSelRowIndex, getSelColumnIndex, selectRow(int), selectColumn(int)
Constructor Detail

Table

public Table()
Constructs an empty Table.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

Table

public Table(boolean multipleSelection)
Constructs an empty Table with some properties. If multipleSelection is true, then the user can make multiple selections by clicking on various elements. By default multiple selections are not allowed. A selection can be deselected by selecting the same again.
Parameters:
multipleSelection - If true, allows multiple selections in DOUBLE_CLICK mode.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

Table

public Table(boolean multipleSelection,
             int clickMode)
Constructs an empty Table with some properties. If multipleSelection is true, then the user can make multiple selections by clicking on various elements. If clickMode is SINGLE_CLICK, passing mouse over an element selects it while a single mouse-click causes an action event. If clickMode is DOUBLE_CLICK, passing a single mouse-click selects an element and a double mouse-click causes an action event. Multiple selections are not allowed with SINGLE_CLICK mode.
Parameters:
multipleSelection - If true allows multiple selections in DOUBLE_CLICK mode.
clickMode - Should be one of SINGLE_CLICK, DOUBLE_CLICK.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener actionListener)
Add a listener to recieve action events when the state of an item changes.
Parameters:
actionListener - An action listener object.
See Also:
removeActionListener(ActionListener)

addColumn

public void addColumn(java.lang.String title,
                      java.lang.String[] data)
Add a column of data to the table. title is the title of the column to be added. data is an array of Strings. If the length of data is less than the current number of rows in the table, blank strings will be appended to maintain consistancy. If the length of this array is greater than the current number of rows, the extra elements is neglected.
Parameters:
title - Title of the column.
data - String data.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

addColumn

public void addColumn(int column,
                      java.lang.String title,
                      java.lang.String[] data)
Add a column of data at the specified position. title is the title of the column to be added. data is an array of Strings. If the length of data is less than the current number of rows in the table, blank strings will be appended to maintain consistancy. If the length of this array is greater than the current number of rows, the extra elements are neglected. If column is greater than the current number of columns, the new column is addded at the end.
Parameters:
column - Column index at which the new column is inserted.
title - Title of the column.
data - String data.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

addItemListener

public void addItemListener(java.awt.event.ItemListener itemListener)
Add a listener to recieve item events when an element state changes. Element state changes when a element/row/column is selected/deselected.
Implements:
addItemListener in interface java.awt.ItemSelectable
Parameters:
itemListener - An item listener object.
See Also:
removeItemListener(ItemListener)

addMouseListener

public void addMouseListener(java.awt.event.MouseListener mouseListener)
Add a listener to receive mouse events.
Parameters:
mouseListener - A mouse listener object.
Overrides:
addMouseListener in class java.awt.Component
See Also:
removeMouseListener(MouseListener)

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener mouseMotionListener)
Add a listener to receive mouse motion events.
Parameters:
mouseMotionListener - A mouse motion listener object.
Overrides:
addMouseMotionListener in class java.awt.Component
See Also:
removeMouseMotionListener(MouseMotionListener)

addRow

public void addRow(java.lang.String[] s)
Adds a row of data at the end. If the length of data is less than the current number of columns in the table, blank strings will be appended to maintain consistancy. If the length of this array is greater than the current number of columns, the extra elements are neglected.
Parameters:
s - String data.
See Also:
addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

addRow

public void addRow(int r,
                   java.lang.String[] s)
Adds a row of data. If the length of data is less than the current number of columns in the table, blank strings will be appended to maintain consistancy. If the length of this array is greater than the current number of columns, the extra elements are neglected. If the specified index r is greater than the current number of rows, row is added at the end.
Parameters:
r - Row index at which the new column is inserted.
s - String data.
See Also:
addRow(java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

allowDrag

public void allowDrag(boolean allowDrag)
Note: allowDrag() is deprecated.Use setEnabled() instead to enable/disable all event handling including drag.

Allows/disallows column resize via mouse drag.
Parameters:
allowDrag - If true allows column resize. Default is true.

allowMultipleSelections

public void allowMultipleSelections(boolean allowMultipleSelections)
Allows/disallows multiple selections.
Parameters:
allowMultipleSelections - If true, in DOUBLE_CLICK mode multiple selections are allowed.

clear

public void clear()
Clears the data in the table. Removes all the data in the table. Column header is not cleared. Calls repaint.

clearAll

public void clearAll()
Clears the data and the header as well. Calls repaint.

deleteColumn

public java.lang.String[] deleteColumn(int c)
Delete a specified column of data. If a column with the specified index does not exist, nothing is done. The return array contains the title and data of the deleted column.
Parameters:
c - Index of the column to delete.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int)

deleteRow

public java.lang.String[] deleteRow(int r)
Deletes a specified row of data. If a row with the specified index does not exit, nothing is done. The return array contains the data of the deleted row.
Parameters:
r - index of the row to delete.
See Also:
addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteColumn(int)

getClickMode

public int getClickMode()
Gets the current click-mode (one of SINGLE_CLICK and DOUBLE_CLICK)
See Also:
setClickMode(int), SINGLE_CLICK, DOUBLE_CLICK

getElement

public java.lang.String getElement(int row,
                         int column)
Returns the elemenent at [row, column].
Parameters:
row - Row index.
column - Column index.
Returns:
String data at [row, column]
See Also:
setElement(int, int, java.lang.String), setElement(COM.Subrahmanyam.table.TElement)

getFonts

public java.awt.Font[] getFonts()
Gets the current fonts.
Returns:
Array of Font of size 2. The first element contains the font for the header and the second contains that of the data area.
See Also:
setFonts(java.awt.Font, java.awt.Font)

getHiliteMode

public int getHiliteMode()
Gets the current hilite mode. Returns one of Table.HILITE_ELEMENT, Table.HILITE_ROW, and Table.HILITE_COLUMN
See Also:
setHiliteMode(int), HILITE_ELEMENT, HILITE_ROW, HILITE_COLUMN

getNoColumns

public int getNoColumns()
Returns the number of columns.
See Also:
getNoRows

getNoRows

public int getNoRows()
Returns the number of rows.
See Also:
getNoColumns

getScale

public int[] getScale()
Returns the current scale-factors of columns. Returns an array of integers that indicate relative widths of columns.
See Also:
setScale(int[])

getSelColumnIndex

public int getSelColumnIndex()
Returns index of the selected column.
See Also:
OUT_OF_FOCUS, getSelRowIndex, selectRow(int), selectColumn(int)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Get selected objects.
Implements:
getSelectedObjects in interface java.awt.ItemSelectable

getSelRowIndex

public int getSelRowIndex()
Returns index of the currently selected row.
See Also:
OUT_OF_FOCUS, getSelColumnIndex, selectRow(int), selectColumn(int)

getSelection

public TElement[] getSelection()
Note: getSelection() is deprecated.This function is now replaced by getSelectedObjects().

Returns an array of TElement objects.

getBottomRowIndex

public int getBottomRowIndex()
Gets the index of the row at the top of the visible area. Returns -1 if the table is empty.
See Also:
getTopRowIndex(), getPageHeight()

getPageHeight

public int getPageHeight()
Gets the page height. Page height is the number of visible rows in the data area. This is equal to the height of the data area divided by the line height (both in pixels). Page height can only by changed by resizing the table.
See Also:
getTopRowIndex(), getBottomRowIndex()

getTopRowIndex

public int getTopRowIndex()
Gets the index of the row at the bottom of the visible area. If fewer number of rows exist than the pageHeight, returns the last row index. Returns -1 if the table is empty.
See Also:
getBottomRowIndex(), getPageHeight()

isElementSelected

public boolean isElementSelected(int row,
                                 int col)
Determines if an element specified by row and column indices is selected. In HILITE_ROW/HILITE_COLUMN mode, set col = 0 or row = 0.
Parameters:
row - Row index.
col - Column index.
Returns:
true if the element is selected.

isEnabled

public boolean isEnabled()
Determines whether the Table is currently enabled or disabled.
Overrides:
isEnabled in class java.awt.Component

processComponentEvent

public final void processComponentEvent(java.awt.event.ComponentEvent ce)
Component event handler.
Overrides:
processComponentEvent in class java.awt.Component

removeActionListener

public void removeActionListener(java.awt.event.ActionListener actionListener)
Remove the specified action listener.
See Also:
addActionListener(ActionListener)

removeItemListener

public void removeItemListener(java.awt.event.ItemListener itemListener)
Removes the specified item listener.
Implements:
removeItemListener in interface java.awt.ItemSelectable
See Also:
addItemListener(ItemListener)

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener ml)
Removes the specified mouse listener.
Overrides:
removeMouseListener in class java.awt.Component
See Also:
addMouseListener(MouseListener)

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener ml)
Removes the specified mouse motion listener.
Overrides:
removeMouseMotionListener in class java.awt.Component
See Also:
removeMouseMotionListener(MouseMotionListener)

repaint

public final void repaint()
Repaints the Table.
Overrides:
repaint in class java.awt.Component

setSize

public final void setSize(int width,
                          int height)
Resizes the Table to the specified width and height.
Parameters:
width - Width of the table.
height - Height of the table.
Overrides:
setSize in class java.awt.Component

selectColumn

public void selectColumn(int col)
Selects a column. The specified column will be displayed as selected.
Parameters:
col - Column to be selected.
See Also:
getSelColumnIndex, getSelRowIndex, selectRow(int)

selectRow

public void selectRow(int row)
Selects a row. The specified row will be displayed as selected. The table will be scrolled up/down if necessary.
Parameters:
row - Row to be selected.
See Also:
selectColumn(int), getSelRowIndex, getSelColumnIndex

setClickMode

public void setClickMode(int m)
Sets the selection mode.
Parameters:
m - Should be one of SINGLE_CLICK and DOUBLE_CLICK.
See Also:
getClickMode, SINGLE_CLICK, DOUBLE_CLICK

setColors

public void setColors(java.awt.Color headFG,
                      java.awt.Color headBG,
                      java.awt.Color dataFG,
                      java.awt.Color dataBG,
                      java.awt.Color revDataFG,
                      java.awt.Color revDataBG)
Sets colors for the header, data (normal and reverse) and the drag line. These colors are applicable for the entire table. Any or all of the arguments may be null, in which case default colors will be used.
Parameters:
headFG - Foreground color for the header.
headBG - Background color for the header.
dataFG - Foreground color for the data.
dataBG - Background color for the data.
revDataFG - Reverse foreground color for the data.
revDataBG - Reverse background color for the data.
See Also:
setColors(int, int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setColumnColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setRowColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color)

setColors

public void setColors(int row,
                      int col,
                      java.awt.Color dataFG,
                      java.awt.Color dataBG,
                      java.awt.Color revDataFG,
                      java.awt.Color revDataBG)
Sets colors of a data item. Data item is specified by its row and column. Any or all of the Color arguments may be null, in which case default colors will be used.
Parameters:
row - Row.
col - Column.
dataFG - Foreground color for the data.
dataBG - Background color for the data.
revDataFG - Reverse foreground color for the data.
revDataBG - Reverse background color for the data.
See Also:
setColors(java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setColumnColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setRowColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color)

setColumnColors

public void setColumnColors(int col,
                            java.awt.Color dataFG,
                            java.awt.Color dataBG,
                            java.awt.Color revDataFG,
                            java.awt.Color revDataBG)
Sets colors of a column. Any or all of Color arguments may be null, in which case default colors will be used.
Parameters:
col - Column.
dataFG - Foreground color for the data.
dataBG - Background color for the data.
revDataFG - Reverse foreground color for the data.
revDataBG - Reverse background color for the data.
See Also:
setColors(java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setColors(int, int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setRowColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color)

setElement

public void setElement(int row,
                       int column,
                       java.lang.String s)
Sets the elemenent at [row, column] to the specified string.
Parameters:
row - Row index.
column - Column index.
s - String data.
See Also:
getElement, setElement(COM.Subrahmanyam.table.TElement)

setElement

public void setElement(TElement element)
Sets the element specified by a TElement object.
Parameters:
element - COM.Subrahmanyam.table.TElement object containing the row, column and string data.
See Also:
getElement, setElement(int, int, java.lang.String)

setEnabled

public void setEnabled(boolean b)
Enables/disables the Table widget.
Overrides:
setEnabled in class java.awt.Component

setFonts

public void setFonts(java.awt.Font fh,
                     java.awt.Font fd)
Sets the fonts.
Parameters:
fh - Font for the header.
fd - Font for the data area.
See Also:
getFonts

setHiliteMode

public void setHiliteMode(int m)
Sets the hilite mode. m should be one of HILITE_ELEMENT, HILITE_ROW, HILITE_COLUMN.
See Also:
getHiliteMode, HILITE_ELEMENT, HILITE_ROW, HILITE_COLUMN

setLineSpacing

public void setLineSpacing(double lineSpacing)
Sets the inter-row spacing.
Parameters:
lineSpacing - A double value. A value of 1.0 means single-spaced rows.

setRowColors

public void setRowColors(int row,
                         java.awt.Color dataFG,
                         java.awt.Color dataBG,
                         java.awt.Color revDataFG,
                         java.awt.Color revDataBG)
Sets colors of a row.
Parameters:
row - Row.
dataFG - Foreground color for the data.
dataBG - Background color for the data.
revDataFG - Reverse foreground color for the data.
revDataBG - Reverse background color for the data.
See Also:
setColors(java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setColors(int, int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color), setColumnColors(int, java.awt.Color, java.awt.Color, java.awt.Color, java.awt.Color)

setScale

public void setScale(int[] scaleArr) throws java.lang.IllegalArgumentException
Sets scale-factors for all the columns. To be called after each call to addColumn and deleteColumn. Each element should be indicative of the relative width of a column. For example, for a 3-column table, [10, 10, 10] will make equal-width columns; and [20, 10, 10] will double the width of the first column with respect to the other two columns.
Parameters:
scaleArr - An array of integers. Length must be equal to the number of columns. Otherwise throws the run-time exception java.lang.IllegalArgumentException.
Throws:
java.lang.IllegalArgumentException -
See Also:
getScale, addRow(java.lang.String[]), addRow(int, java.lang.String[]), addColumn(java.lang.String, java.lang.String[]), addColumn(int, java.lang.String, java.lang.String[]), deleteRow(int), deleteColumn(int)

showHorizontalSeparator

public void showHorizontalSeparator(boolean s)
Shows/hides row separators.
Parameters:
s - true shows horizontal separator between columns. false hides horizontal separators.
See Also:
showVerticalSeparator(boolean)

showVerticalSeparator

public void showVerticalSeparator(boolean s)
Shows/hides column separators.
Parameters:
s - true shows vertical separator between columns. false hides vertical separators.
See Also:
showVerticalSeparator(boolean)

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS