java - How to use model.addRow() to add rows after the JTable is already added? -
public void initjtabpane() throws filenotfoundexception, ioexception{ //jtable bot shit model = new defaulttablemodel() { @override public boolean iscelleditable(int row, int column) { //only third column return column == 4; } }; jt = new jtable(); // create couple of columns model.addcolumn("col1"); model.addcolumn("col2"); model.addcolumn("col3"); model.addcolumn("col5"); // append row model.addrow(new object[]{"name", "ip","country","specs"}); jt.setmodel(model); panel1.add(jt); }
i can add rows doing model.addrow()
in initjtabpane()
method, cannot add rows in other methods. how come?
thanks, neil
Comments
Post a Comment