com.sun.lwuit.table
Class DefaultTableModel

java.lang.Object
  extended by com.sun.lwuit.table.DefaultTableModel
All Implemented Interfaces:
TableModel

public class DefaultTableModel
extends java.lang.Object
implements TableModel

A default implementation of the table model based on a two dimensional array.


Constructor Summary
DefaultTableModel(java.lang.String[] columnNames, java.lang.Object[][] data)
          Constructs a new table with a 2 dimensional array for row/column data
DefaultTableModel(java.lang.String[] columnNames, java.lang.Object[][] data, boolean editable)
          Constructs a new table with a 2 dimensional array for row/column data
 
Method Summary
 void addDataChangeListener(DataChangedListener d)
          Adds a listener to the data changed event
 int getColumnCount()
          Returns the number of columns in the table
 java.lang.String getColumnName(int i)
          Returns the name of the column at the given offset
 int getRowCount()
          Returns the number of rows in the table
 java.lang.Object getValueAt(int row, int column)
          Returns the value of the cell at the given location
 boolean isCellEditable(int row, int column)
          Returns true if the cell at the given location is an editable cell
 void removeDataChangeListener(DataChangedListener d)
          Removes a listener to the data changed event
 void setValueAt(int row, int column, java.lang.Object o)
          Sets the value of the cell at the given location
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTableModel

public DefaultTableModel(java.lang.String[] columnNames,
                         java.lang.Object[][] data)
Constructs a new table with a 2 dimensional array for row/column data

Parameters:
columnNames - the names of the columns
data - the data within the table

DefaultTableModel

public DefaultTableModel(java.lang.String[] columnNames,
                         java.lang.Object[][] data,
                         boolean editable)
Constructs a new table with a 2 dimensional array for row/column data

Parameters:
columnNames - the names of the columns
data - the data within the table
editable - indicates whether table cells are editable or not by default
See Also:
isCellEditable(int, int)
Method Detail

getRowCount

public int getRowCount()
Description copied from interface: TableModel
Returns the number of rows in the table

Specified by:
getRowCount in interface TableModel
Returns:
the number of rows in the table

getColumnCount

public int getColumnCount()
Description copied from interface: TableModel
Returns the number of columns in the table

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in the table

getColumnName

public java.lang.String getColumnName(int i)
Description copied from interface: TableModel
Returns the name of the column at the given offset

Specified by:
getColumnName in interface TableModel
Parameters:
i - the offset for the column name
Returns:
name to display at the top of the table

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Description copied from interface: TableModel
Returns true if the cell at the given location is an editable cell

Specified by:
isCellEditable in interface TableModel
Parameters:
row - the cell row
column - the cell column
Returns:
true if the cell at the given location is an editable cell

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Description copied from interface: TableModel
Returns the value of the cell at the given location

Specified by:
getValueAt in interface TableModel
Parameters:
row - the cell row
column - the cell column
Returns:
the value of the cell at the given location

setValueAt

public void setValueAt(int row,
                       int column,
                       java.lang.Object o)
Description copied from interface: TableModel
Sets the value of the cell at the given location

Specified by:
setValueAt in interface TableModel
Parameters:
row - the cell row
column - the cell column
o - the value of the cell at the given location

addDataChangeListener

public void addDataChangeListener(DataChangedListener d)
Description copied from interface: TableModel
Adds a listener to the data changed event

Specified by:
addDataChangeListener in interface TableModel
Parameters:
d - the new listener

removeDataChangeListener

public void removeDataChangeListener(DataChangedListener d)
Description copied from interface: TableModel
Removes a listener to the data changed event

Specified by:
removeDataChangeListener in interface TableModel
Parameters:
d - the listener to remove