Como criar o metodo setValueAt no meu model?

0 respostas
Jarder_Silva

Bem eu tenho uma classe que e meu Model das minhasjTable

public class MyModel extends AbstractTableModel {

private ArrayList linhas = null;
private String[] colunas = null;

public MyModel(ArrayList lin, String[] col) {

    setLinhas(lin);
    setColunas(col);

}

public ArrayList getLinhas() {
    return linhas;
}

public void setLinhas(ArrayList linhas) {
    this.linhas = linhas;
}

public String[] getColunas() {
    return colunas;
}

public void setColunas(String[] colunas) {
    this.colunas = colunas;
}

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];
}

@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
    return false;
}

}

queria colocar nesta classe o metodo setValueAt, pra que eu possa alterar um valor da minha jTable

Criado 10 de março de 2016
Respostas 0
Participantes 1