public class StringArrayTableModel extends Object implements TableModel
A table model that gets its data from a String array.
TableModel.TableModelEvent| Constructor and Description |
|---|
StringArrayTableModel(int columns,
String... colnames)
Create a new table cell model with the given data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRow(String... values) |
void |
addTableModelListener(ActionListener<TableModel.TableModelEvent> l)
Add a listener to be notified of changes to the model.
|
void |
deleteRow(int row) |
ContentType |
getCellContentType(int row,
int column)
Get the content type of a cell.
|
int |
getColumnCount()
Get the number of columns in the model.
|
String |
getColumnName(int column)
Get the name of the given column
|
int |
getRowCount()
Get the number of rows in the model.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
Get the value of a particular cell.
|
void |
insertRow(int rowNum,
String... values) |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Check if the cell is editable.
|
void |
removeTableModelListener(ActionListener<TableModel.TableModelEvent> l)
Remove a listener.
|
void |
setValueAt(Object value,
int rowIndex,
int columnIndex)
Set the value in a cell.
|
public StringArrayTableModel(int columns,
String... colnames)
Create a new table cell model with the given data.
columns - The number of columnscolnames - The cell data. The first columns values are interpreted as the column names, and the rest is row data.public ContentType getCellContentType(int row, int column)
TableModelGet the content type of a cell.
getCellContentType in interface TableModelrow - The row.column - The columnpublic int getColumnCount()
TableModelGet the number of columns in the model.
getColumnCount in interface TableModelpublic String getColumnName(int column)
TableModelGet the name of the given column
getColumnName in interface TableModelcolumn - The column numberpublic int getRowCount()
TableModelGet the number of rows in the model.
getRowCount in interface TableModelpublic Object getValueAt(int rowIndex, int columnIndex)
TableModelGet the value of a particular cell.
getValueAt in interface TableModelrowIndex - The row of the cellcolumnIndex - The column of the cellpublic boolean isCellEditable(int rowIndex,
int columnIndex)
TableModelCheck if the cell is editable.
isCellEditable in interface TableModelrowIndex - The rowcolumnIndex - The columnpublic void setValueAt(Object value, int rowIndex, int columnIndex)
TableModelSet the value in a cell.
setValueAt in interface TableModelvalue - The value to set.rowIndex - The rowcolumnIndex - The columnpublic void addTableModelListener(ActionListener<TableModel.TableModelEvent> l)
TableModelAdd a listener to be notified of changes to the model.
addTableModelListener in interface TableModelpublic void removeTableModelListener(ActionListener<TableModel.TableModelEvent> l)
TableModelRemove a listener.
removeTableModelListener in interface TableModelpublic void insertRow(int rowNum,
String... values)
public void addRow(String... values)
public void deleteRow(int row)
Copyright © 2022. All Rights Reserved.