public class DefaultTableModel extends Object implements TableModel
Constructor and Description |
---|
DefaultTableModel(String[] columnNames,
Object[][] data)
Constructs a new table with a 2 dimensional array for row/column data
|
DefaultTableModel(String[] columnNames,
Object[][] data,
boolean editable)
Constructs a new table with a 2 dimensional array for row/column data
|
Modifier and Type | Method and Description |
---|---|
void |
addDataChangeListener(DataChangedListener d)
Adds a listener to the data changed event
|
int |
getColumnCount()
Returns the number of columns in the table
|
String |
getColumnName(int i)
Returns the name of the column at the given offset
|
int |
getRowCount()
Returns the number of rows in the table
|
Object |
getValueAt(int row,
int column)
Returns the value of the cell at the given location
|
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at the given location is an editable cell
|
void |
removeDataChangeListener(DataChangedListener d)
Removes a listener to the data changed event
|
void |
setValueAt(int row,
int column,
Object o)
Sets the value of the cell at the given location
|
public DefaultTableModel(String[] columnNames, Object[][] data)
columnNames
- the names of the columnsdata
- the data within the tablepublic DefaultTableModel(String[] columnNames, Object[][] data, boolean editable)
columnNames
- the names of the columnsdata
- the data within the tableeditable
- indicates whether table cells are editable or not by defaultisCellEditable(int, int)
public int getRowCount()
TableModel
getRowCount
in interface TableModel
public int getColumnCount()
TableModel
getColumnCount
in interface TableModel
public String getColumnName(int i)
TableModel
getColumnName
in interface TableModel
i
- the offset for the column namepublic boolean isCellEditable(int row, int column)
TableModel
isCellEditable
in interface TableModel
row
- the cell rowcolumn
- the cell columnpublic Object getValueAt(int row, int column)
TableModel
getValueAt
in interface TableModel
row
- the cell rowcolumn
- the cell columnpublic void setValueAt(int row, int column, Object o)
TableModel
setValueAt
in interface TableModel
row
- the cell rowcolumn
- the cell columno
- the value of the cell at the given locationpublic void addDataChangeListener(DataChangedListener d)
TableModel
addDataChangeListener
in interface TableModel
d
- the new listenerpublic void removeDataChangeListener(DataChangedListener d)
TableModel
removeDataChangeListener
in interface TableModel
d
- the listener to remove