I have a AbstractTableModel
only that I do not know how to add blank lines, when I hit the add line button in my frame I want it to call a method called addLine () from my TableTable, can anyone help me?
public class ModeloTabela2 extends AbstractTableModel {
private ArrayList linhas = new ArrayList();
private String[] colunas = {"DATA", "EVOLUÇÃO"};
public boolean isCellEditable(int linha, int coluna) {
return true;
}
public ArrayList getLinhas(){
return linhas;
}
public void setLinhas(ArrayList dados){
linhas = dados;
}
public String[] getColunas(){
return colunas;
}
public void setColunas(String[] nomes){
colunas = nomes;
}
public int getColumnCount(){
return colunas.length;
}
public int getRowCount(){
return linhas.size();
}
public String getColumnName(int numCol){
return colunas[numCol];
}
public Object getValueAt(int numLin, int numCol){
Object[] linha = (Object[])getLinhas().get(numLin);
return linha[numCol];
}
public Class<?> getColumnClass(int coluna) {
switch(coluna){
case 0:
return String.class;
case 1:
return String.class;
default:
return String.class;
}
}
public void addLinha(){ //Aqui eu adicionaria a linha em branco...
}
}