permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes Changing row color in jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Changing row color in jtable" Watch "Changing row color in jtable" New topic
Author

Changing row color in jtable

Samlin Ford
Greenhorn

Joined: Mar 08, 2004
Posts: 2
Hi friends
I have two JTables. The first one has 7 columns and 10 rows (with data) but the second one is empty.
The user can choose one row from first table and by pressing the ((copy)) button , copy that row to the second table. Is it possible to change the color of those rows(in the first table) that been copied to the second table. I mean if the user choose a row and copy then to the second table, the color of this row wold be changed.
Can anybody help me with that??
Thanks
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You'll have to use a custom TableCellRenderer, and the data in your table model will in some way have to reflect the fact that this row was "copied". How are you currently handling the data in the TableModels?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing row color in jtable
 
Similar Threads
JTable(!!!)
DefaultTableModel and Multiple Selections.
Removing row from table
Please help with the 3 Hardest Javascript problems in the world
Row validation in a table