Move a row to top of the JTable

Hy,

I am building an Ftp client in swing. I have a JTable that shows the user what files are in the queue.

The problem is that i want every new row to enter the table from the top and not come last in the table. I use a DefaultTableModel. This model has a method called moveRow.

moveRow(int start,int end,int to)

the method and its parameters look very easy but somehow i cant get it right.

Anyone?

[539 byte] By [S1lv3ra] at [2007-11-26 22:26:26]
# 1

// not sure but i think that row count start at 0 so...

int start; // getRowCount() - 2

int end; // getRowCount() - 1

int to; // 0 because you want to put it first !

suparenoa at 2007-7-10 11:27:57 > top of Java-index,Desktop,Core GUI APIs...
# 2
Basicly i need the bottom row to go on top and the rest stays where it is.
S1lv3ra at 2007-7-10 11:27:57 > top of Java-index,Desktop,Core GUI APIs...
# 3
so the bottom is equals to the last row: getRowCount() -1;the top row is equals to 0 !you want to move 1 row so it starts at last row -1 to last row at position 0
suparenoa at 2007-7-10 11:27:57 > top of Java-index,Desktop,Core GUI APIs...
# 4
Have you tried DefaultTableModel.insertRow( 0, dataVector ) instead of using addRow( dataVector ) ?
JayDSa at 2007-7-10 11:27:57 > top of Java-index,Desktop,Core GUI APIs...