TableModel
interface specifies 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);
For further documentation, see Creating a Table Model in The Java Tutorial.
JTable
to set up a
default renderer and editor for the column.JTable
uses this method to determine how many columns it
should create and display by default.columnIndex
. This is used
to initialize the table's column header name. Note: this name does
not need to be unique; two columns in a table can have the same name.JTable
uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.columnIndex
and
rowIndex
.rowIndex
and
columnIndex
is editable. Otherwise, setValueAt
on the cell will not
change the value of that cell.columnIndex
and
rowIndex
to aValue
.