Calling repaint

Hi, guys!

I created an application which loads data from a file and stores it into an ArrayList and then display it in a JTable. I made the table to allow row selection and then I click when a button [DELETE] is clicked it deletes the selected row. All of that works fine, but, my problem is: HOW CAN I DISPLAY THE CHANGE? That is, redraw/repaint the table reflecting the change ...

I tried with jTable1.repaint, it did not work!

Any suggestions will be greatly appreciated.

oRion ...

[515 byte] By [oRioNa] at [2007-10-3 3:52:13]
# 1
TableModel.fireTableDataChanged()
PhHeina at 2007-7-14 21:49:59 > top of Java-index,Desktop,Core GUI APIs...
# 2

> TableModel.fireTableDataChanged()

We've been through this before. That is not the answer for everthing and especially not the answer in this case.

The DefaultTableModel has a remove row method that will fire the tableRowsDeleted(...) method which will cause the table to repaint itself. So you don't do anything special.

If you wrote you own TableModel then your delete rows method should invoke that method.

If you use fireTableDataChanged() then the TableColumnModel will be recreated from scratch. This means:

a) If the user has resized the width of any TableColumn the customization will be lost and the width reset to the default 75 pixels

b) If the user has reordered any column this information will be lost and the columns will be redisplayed in the TableModel column order

c) If any custom renderers and editors have been add to the table they will also be lost when the TCM is recreated.

camickra at 2007-7-14 21:49:59 > top of Java-index,Desktop,Core GUI APIs...
# 3
> We've been through this before. That is not the> answer for everthing and especially not the answer in> this case.Yep, but it always triggers you to post the complete details, for which I'm too lazy ;)
PhHeina at 2007-7-14 21:49:59 > top of Java-index,Desktop,Core GUI APIs...