Updating a jtable books dating publications

30 Dec

You need to have your JTable use a Table Model such as an Abstract Table Model or Default Table Model and then change the data in the table model when desired. You should only be storing text in the model and then let a renderer render the text.according to the answer provided in your previous question, then there is no relationship with the data in the model to the external source.You need to manually reload the data from the external source, create a new according to the answer provided in your previous question, then there is no relationship with the data in the model to the external source.For example, in the above code I could do this, and it would still work as you'd expect.private JPanel rootpanel; private JTable test Table; private Default Table Model table Model; private JScroll Pane test Scroll Pane; private JButton test Button; table Model = new Default Table Model(); test Table = new JTable(table Model); Take a look at the Java Tutorial.

Instead, you need to change the Table Model directly by using the Hm. But what should be required "reason" for recreating entire table model?

The table API is capable of managing itself, so changing the values via the table shouldn't require any additional input from you.

Changes made externally are a little more complicated, depending on the amount of change.

instead, which already includes the implementations of the listener registration and notification.

You will need to provide a method that will allow you to add a row to the table model.