Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

moving different rows with a mouse up and down  RSS feed

 
Steffen Durale
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,
i have a jtable with an abstract table model.
now i want to move different rows [for example the 2nd and the 4th row] by mouse in another position [for example to the 1st and 3rd row]
but how?
please help me... its urgent
regards
Steffen
 
Jagan Mohan Reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think if you try on these lines this might help you.

Think mouselistener event should be something like this.
public void mousePressed(MouseEvent me) {

selectedRow = table.getSelectedRow();


}
public void mouseReleased(MouseEvent me) {
Point point = new Point(me.getX(),me.getY());
int currentRow = table.rowAtPoint(point);

(currentRow!= -1) {
tableModel.moveRow(selectedRow,selectedRow,currentRow);
}

}

If you try on these ground this might help you out.
Regards,
Jagan Mohan Reddy.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!