Доброго времени суток! вознкла проблема, написал модель для таблицы| Код | public class TableDataModel extends AbstractTableModel { private static int colCount=4; private static int rowCount=2;
public void fireTableCellUpdated(int row, int column) { super.fireTableCellUpdated(row, column); //To change body of overridden methods use File | Settings | File Templates. }
public void setValueAt(Integer aValue, int rowIndex, int columnIndex) { ChartData cd=Manager.getChartDataArray().get(rowIndex-1); ArrayList<Integer> col=cd.getY(); col.set(columnIndex-1,aValue); cd.setY(col); Manager.getChartDataArray().set(rowIndex-1,cd);
}
public boolean isCellEditable(int rowIndex, int columnIndex) { return true; }
public void addRow() { ArrayList<Integer> v1=new ArrayList(); for(int i=0;i<colCount;i++) v1.add(5); Manager.addRow(v1); rowCount++; TableModelEvent tEvent = new TableModelEvent(this); this.fireTableChanged(tEvent); }
public void remRow() { if (rowCount!=1) { Manager.remRow(rowCount); rowCount--; } TableModelEvent tEvent = new TableModelEvent(this); this.fireTableChanged(tEvent); }
public int getRowCount() { return rowCount; //To change body of implemented methods use File | Settings | File Templates. }
public int getColumnCount() { return colCount; //To change body of implemented methods use File | Settings | File Templates. }
public Integer getValueAt(int rowIndex, int columnIndex) { return Manager.getChartDataArray().get(rowIndex).getY(columnIndex); //To change body of implemented methods use File | Settings | File Templates. }
}
|
когда \ редактирую ячейку, после ввода нового числа оно не отображается, а выводиться старое, не могу понять в чем дело, м.б. в менеджере данные не заменяются,???? заранее спасибо!! |