Moving a row in jTable

Attilah picture Attilah · Oct 4, 2009 · Viewed 12.3k times · Source

How can one move a row in jTable so that row1 goes to row2's position and row2 goes to row1's position ?

Answer

camickr picture camickr · Oct 4, 2009

Use the moveRow(...) method of the DefaultTableModel.

Or, if you aren't using the DefaultTableModel then implement a simliar method in your custom model.