Hello everyone,
My data varies and it does't have fixed rows.
Every time the rows has to be increased based on the data
for e.g i initialize the no of rows to 3.
i know how much rows to be inserted
could any one tell me how to do this........
I am using table model the code snippet is as follows
class AlarmTableModel extends DefaultTableModel
{
int tableSize = 3;
int colNo = 0;
int rowCount = 0;
String tableData[][] = null;
public AlarmTableModel(int c){
colNo = c;
init(tableSize);
}
//public void init(){
public void init(int row){
tableData = new String[row][colNo];
rowCount = 0;
fireTableDataChanged();
}
public int getColumnCount() { return colNo; }
public int getRowCount() { return tableSize; }
public int getEnteredRowCount() { return rowCount; }
public Object getValueAt (int row, int col) {
if (row >= tableSize || col >= colNo)
return null;
else
return tableData[row][col];
}
public void setValueAt (Object aValue, int row, int column) {
String cellValue = null;
if (aValue instanceof String)
{
if (row >= tableSize) return;
cellValue = (String)aValue;
tableData[row][column] = cellValue;
fireTableCellUpdated (row, column);
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