I
I
Ivan Karabadzhak2012-01-22 04:43:57
Java
Ivan Karabadzhak, 2012-01-22 04:43:57

How to properly update data in JTable after changing it in source?

I have a program. Some set of data is stored in an ArrayList object. I inherited the AbstractTableModel table model and use it to pass data to the table. The model receives a reference to an ArrayList object. How to properly update the table after adding data to the ArrayList object? Otherwise, you have to hang myTable.updateUI () everywhere in the interface.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mayorovp, 2012-01-22
@mayorovp

It is more correct to update the table through the model.
Take a closer look at the protected members of the AbstractTableModel.

V
vtysh, 2012-01-23
@vtysh

docs.oracle.com/javase/1.4.2/docs/api/javax/swing/table/AbstractTableModel.html#fireTableRowsInserted(int , int)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question