|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The TableModel interface ispecifies the methods the JTable will use to interrogate a tabular data model.
The JTable can be set up to display any data model which implements the TableModel interface with a couple of lines of code:
TableModel myData = new MyTableModel();
JTable table = new JTable(myData);
JTable
,
AbstractTableModel
Method Summary | |
void |
addTableModelListener(TableModelListener l)
Add a listener to the list that's notified each time a change to the data model occurs. |
Class |
getColumnClass(int columnIndex)
Returns the lowest common denominator Class in the column. |
int |
getColumnCount()
Returns the number of columns managed by the data source object. |
String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex. |
int |
getRowCount()
Returns the number of records managed by the data source object. |
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns an attribute value for the cell at columnIndex and rowIndex. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and columnIndex is editable. |
void |
removeTableModelListener(TableModelListener l)
Remove a listener from the list that's notified each time a change to the data model occurs. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Sets an attribute value for the record in the cell at columnIndex and rowIndex. |
Method Detail |
public int getRowCount()
getColumnCount()
public int getColumnCount()
getRowCount()
public String getColumnName(int columnIndex)
columnIndex
- the index of columnpublic Class getColumnClass(int columnIndex)
public boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
- the row whose value is to be looked upcolumnIndex
- the column whose value is to be looked upsetValueAt(java.lang.Object, int, int)
public Object getValueAt(int rowIndex, int columnIndex)
rowIndex
- the row whose value is to be looked upcolumnIndex
- the column whose value is to be looked uppublic void setValueAt(Object aValue, int rowIndex, int columnIndex)
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changedgetValueAt(int, int)
,
isCellEditable(int, int)
public void addTableModelListener(TableModelListener l)
l
- the TableModelListenerpublic void removeTableModelListener(TableModelListener l)
l
- the TableModelListener
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |