I've created a JTable which uses AbstractTableModel because i need to display booleans as check boxes. It is inside a JScrollPane and the table loads fine with the data I add to the data vector before the table is displayed, but I'm not able to add a row later or even modify existing data. I've tried all the fireTable* methods I found in the API, but nothing worked. The vector is updated with the new data, but it is not displayed in the table. The only way I am able to modify the JTable during runtime is when I change values in the event handler like this:
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if ("execute".equals(e.getActionCommand()))
table.setValueAt("data",1,1);
}
Unfortunately this only works when a button is pressed, but JTable needs to display a list of clients which updates as they connect.
This is the addRow method i tried to use that does not work:
public void addRow(String name, String response, Boolean active)
{
int size = data.size();
data.addElement(new cpu(name, response, active));
fireTableRowsInserted(size, size);
}
I've been struggling with this for a few days now,so ANY suggestions will help.
Thank you very much!!!
P.S. here's what I've tried and it didn't work:
table.addNotify();
fireTable*(everything)
repaint();
I'm out of ideas.
Message was edited by:
daqqad