Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to place JTable rows in desired order

 
viswanath kuppam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to implement a feature like, JTable will display list of rows and each row will contain two buttons like uparrow and downarrow. whenever user clicks on uparrow then corresponding row should move one row up. In the same way whenever user clicks on downarrow correspond row should move one row down.
Can you please suggest how to achieve this, It will great if I get piece of code.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a DefaultTableModel, this class has a moveRow(...) method.
Otherwise you will have to provide one yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic