This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to place JTable rows in desired order  RSS feed

 
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
Boost this thread!