I have a simple JTable, there are two columns that matter: quantity and value (Integers). Each time user enters a new row or updates one, each rows value must be multiplied by quantity, results sumed together and the result sum displayed in a JLabel outside the JTable. Looks pretty simple. Except that I have no idea what event should I look for. Something like “cell value changed”? When I right click on the JTable in NetBeans I see no such event or dont recognize it 😉 Anyway, before I come up with some weird noobish solution I thought I might ask here what’s the proper way to do it 🙂
Share
you should add a TableModelListener as described here.
also, in your listener once you’ve updated the value of the other cell values programatically you will need to call
model.fireTableCellUpdatedto let swing know about the changes