This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to place JTable rows in desired order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to place JTable rows in desired order" Watch "How to place JTable rows in desired order" New topic
Author

How to place JTable rows in desired order

viswanath kuppam
Greenhorn

Joined: Feb 27, 2004
Posts: 3
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

Joined: Jul 03, 2001
Posts: 2120
If you are using a DefaultTableModel, this class has a moveRow(...) method.
Otherwise you will have to provide one yourself.


SCJP2. Please Indent your code using UBB Code
 
Don't get me started about those stupid light bulbs.
 
subject: How to place JTable rows in desired order
 
It's not a secret anymore!