aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes jtable highlight cells (refresh issue) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "jtable highlight cells (refresh issue)" Watch "jtable highlight cells (refresh issue)" New topic
Author

jtable highlight cells (refresh issue)

Preston Taylor
Greenhorn

Joined: Feb 18, 2010
Posts: 7
I have a part of my jtable class that colors certain cells based on their value (see code below) My problem is that when the order of the rows (or columns) are changed the highlite is not refreshed and doesn't fallow it's respective cell



Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2183
    
    7
Once you start sorting or reordering columns you need to understand how model and view work:



There is a similiar method for the column conversion as well.

Preston Taylor
Greenhorn

Joined: Feb 18, 2010
Posts: 7
I did a little reading and looking up of some API. I read through the very little that http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting this page has to offer and as far as I can understand my highlighting is going by the view row rather than the model row?

so is all I need to do is change a few lines in my highlighting code to convert the coordinates or am I over simplifying?
Preston Taylor
Greenhorn

Joined: Feb 18, 2010
Posts: 7
Bumpity!

//looked trough the FAQs and tried to find some rules, couldn't...
//hope bumping isn't forbidden.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2183
    
    7
Whats the bump for, you have your answer already?

What happened when you tried the code? If you had a problem, then where is the SSCCE showing the problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jtable highlight cells (refresh issue)