Ralph Cook wrote:I am looking for a technique to use so that, if there is a row selected when a row is added, it remains selected after (and preferably while) a row is added.
Rob is right. But in addition, the "preferably while" part is suspicious. Do you update the model from a background (non-GUI)
thread? If so, you must properly synchronize. Otherwise, if the table gets repainted while your model is being updated, it could provide inconsistent data to
JTable.
I was trying to implement background updates some time ago but then gave up. I now update models always from the GUI thread. In this case no change in the GUI will be displayed while model is updated, including changes in the table selection (row addition does not change selection, but eg. row deletion clearly can).