this code block must contains proper notifiers fireTableRowsInserted(int firstRow, int lastRow), otherwise no row is showed in
JTable
s viewall updates must be done on EDT, more in Oracle tutorial The Event Dispatch Thread
code eamples in Oracle tutorial How to use Tables - Creating a Table Mode
Add row to top of AbstractTableModel
-
30-05-2022 - |
Question
I have a abstractTableModel which I need to add rows to the top, so the user can see the most recent entered data, but default it adds to the bottom of the table. Any suggestions?
Solution
OTHER TIPS
If the AbstractTableModel
is using List
then just while adding the object to the list add it at the zeroth position in the list.
list.add(0, object);
and call respective fireXXXMethod
So now all the objects that are present will move to 1 postion up the list.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow