public class TableModel extends Object
Constructor and Description |
---|
TableModel(int columns)
Constructs a TableModel.
|
TableModel(int columns,
int rowInitCapacity)
Constructs a TableModel.
|
Modifier and Type | Method and Description |
---|---|
int |
columns()
Obtains the number of columns the table is defined for.
|
Comparable |
getField(int row,
int column)
Obtains the field at the given row and column index.
|
String |
getHeader(int column)
Obtains the header for a given column.
|
String[] |
getHeaders()
Obtains all column headers.
|
Comparable[] |
getRow(int row)
Ontains all fields in a given row.
|
Comparable[] |
newRow()
Adds a new row to the table model.
|
int |
rows()
Obtains the number of rows currently in the table.
|
void |
setHeader(int column,
String header)
Sets the header for a given column.
|
public TableModel(int columns)
columns
- The number of columns in the tablepublic TableModel(int columns, int rowInitCapacity)
columns
- The number of columns in the tablerowInitCapacity
- The initial row capacity of the tablepublic int columns()
public Comparable getField(int row, int column)
row
- The row indexcolumn
- The column indexpublic String getHeader(int column)
column
- The column to get the headerpublic String[] getHeaders()
public Comparable[] getRow(int row)
row
- The rowpublic Comparable[] newRow()
public int rows()
public void setHeader(int column, String header)
column
- The columnheader
- The header