views:

83

answers:

2

I have a JTable with several columns and rows. Once the user has moved the column, I would like to be informed via an event of some sort, so that I can do some calculations. However, since all I needed to do was

`table.getTableHeader().setReorderingAllowed(true);`

to get the columns to be movable, I am somewhat unsure what I can use to find out once they have been moved.

Any suggesions?

-F

+1  A: 

To answer my own question..

You need to implement TableModelListener, and the tableChanged method in order to do this.

Cheers, F

Fred
A: 

This tutorial looks at adding a Column Model Listener to a table and detecting when a column is moved. It might be what you are looking for.

Vincent Ramdhanie
Yes, the problem there is that I get an event during the moving of my columns. I would like to be informed once the column has been moved (perhaps I could do some combination with a mouse listener and check that the mouse isn't clicked? Dunno..)-F
Fred