|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TableModel
A TableModel
is a two dimensional data structure that
can store arbitrary Object
instances, usually for the
purpose of display in a JTable
component. Individual
objects can be accessed by specifying the row index and column index for
the object. Each column in the model has a name associated with it.
The DefaultTableModel
class provides one implementation of
this interface.
Method Summary | |
---|---|
void |
addTableModelListener(TableModelListener listener)
Adds a listener to the model. |
Class<?> |
getColumnClass(int columnIndex)
Returns the Class for all Object instances
in the specified column. |
int |
getColumnCount()
Returns the number of columns in the model. |
String |
getColumnName(int columnIndex)
Returns the name of a column in the model. |
int |
getRowCount()
Returns the number of rows in the model. |
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value ( Object ) at a particular cell in the
table. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell is editable, and false
otherwise. |
void |
removeTableModelListener(TableModelListener listener)
Removes a listener from the model. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Sets the value at a particular cell in the table. |
Method Detail |
---|
int getRowCount()
int getColumnCount()
String getColumnName(int columnIndex)
columnIndex
- the column index.
Class<?> getColumnClass(int columnIndex)
Class
for all Object
instances
in the specified column.
columnIndex
- the column index.
boolean isCellEditable(int rowIndex, int columnIndex)
true
if the cell is editable, and false
otherwise.
rowIndex
- the row index.columnIndex
- the column index.
true
if editable, false
otherwise.Object getValueAt(int rowIndex, int columnIndex)
Object
) at a particular cell in the
table.
rowIndex
- the row index.columnIndex
- the column index.
void setValueAt(Object aValue, int rowIndex, int columnIndex)
aValue
- the value (null
permitted).rowIndex
- the row index.columnIndex
- the column index.void addTableModelListener(TableModelListener listener)
listener
- the listener.void removeTableModelListener(TableModelListener listener)
listener
- the listener.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |