Hi ,
I am using the table model in my jtable. I am getting the table model
by the following code.
AlarmTableModel errorModel = (AlarmTableModel)errorTable.getModel();
errorModel.init();
The problem is the when the table has 2 rows of data, the init
method(the code is below) initializes only one row and the other row is
visible, the same happens
randomly like if there are 10 rows of datas of intialized, if i call
init only 5 rows removed and the rest 5 displayed from the 0th row...
could any one suggest how to initialize the table, i dont want to use
setValue method to initialize.......
Thxs
class AlarmTableModel extends DefaultTableModel
{
int rowCount = 0;
public AlarmTableModel(int r, int c)
{
super(r, c);
init();
}
//clearing the data's from the table
public void init()
{
for(int i = 0;i < rowCount;i++)
{
this.removeRow(i);
}
rowCount = 0;
}
public int getEnteredRowCount() { return rowCount; }
public void setValueAt (Object aValue, int row, int column)
{
String cellValue = null;
if (aValue instanceof String)
{
if (row >= this.getRowCount()) return;
cellValue = (String)aValue;
super.setValueAt(cellValue, row, column);
fireTableDataChanged();
if (row >= rowCount) rowCount = row+1;
}
}
public boolean isCellEditable(int row, int column)
{
return false;
}
}
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing