charvax.swing.table
Class DefaultTableModel

java.lang.Object
  extended bycharvax.swing.table.AbstractTableModel
      extended bycharvax.swing.table.DefaultTableModel
All Implemented Interfaces:
TableModel

public class DefaultTableModel
extends AbstractTableModel

This is an implementation of the TableModel interface that uses a Vector of Vectors to store the cell values.


Constructor Summary
DefaultTableModel(int rows_, int columns_)
          Constructs a DefaultTableModel with the specified number of rows and columns, and with cell values of null.
DefaultTableModel(java.lang.Object[][] data_, java.lang.Object[] columnNames_)
          Constructs a DefaultTableModel and initialises the table by passing data_ and columnNames_ to the setDataVector method.
 
Method Summary
 int getColumnCount()
          Get the number of columns in the model.
 java.lang.String getColumnName(int column_)
          Get the name of the specified column.
 int getColumnWidth(int column_)
          Get the width of the specified column.
 int getRowCount()
          Get the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex_, int columnIndex_)
          Returns an attribute value for the cell at (rowIndex, columnIndex)
 void setDataVector(int rows_, int columns_)
          Set up an empty data vector with the specified number of rows and columns.
 void setDataVector(java.lang.Object[][] data_, java.lang.Object[] columnNames_)
          Replaces the values in the _dataVector instance variable with the values in the data_ array.
 void setValueAt(java.lang.Object value_, int row_, int column_)
          Sets the attribute value for the cell at position (row, column).
 
Methods inherited from class charvax.swing.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTableModel

public DefaultTableModel(int rows_,
                         int columns_)
Constructs a DefaultTableModel with the specified number of rows and columns, and with cell values of null.


DefaultTableModel

public DefaultTableModel(java.lang.Object[][] data_,
                         java.lang.Object[] columnNames_)
Constructs a DefaultTableModel and initialises the table by passing data_ and columnNames_ to the setDataVector method.

Method Detail

getColumnCount

public int getColumnCount()
Get the number of columns in the model.


getColumnName

public java.lang.String getColumnName(int column_)
Get the name of the specified column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnWidth

public int getColumnWidth(int column_)
Get the width of the specified column.


getRowCount

public int getRowCount()
Get the number of rows in the model.

Specified by:
getRowCount in interface TableModel
Specified by:
getRowCount in class AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex_,
                                   int columnIndex_)
Returns an attribute value for the cell at (rowIndex, columnIndex)


setValueAt

public void setValueAt(java.lang.Object value_,
                       int row_,
                       int column_)
Sets the attribute value for the cell at position (row, column).

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

setDataVector

public void setDataVector(java.lang.Object[][] data_,
                          java.lang.Object[] columnNames_)
Replaces the values in the _dataVector instance variable with the values in the data_ array. The first index is the row index, the second index is the column index. The columnNames_ array supplies the new column names.


setDataVector

public void setDataVector(int rows_,
                          int columns_)
Set up an empty data vector with the specified number of rows and columns.