• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing:JTreeTable: Coloring and Performace

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am facing a problem with JtreeTable component that has got 2 renderers set.
1. an inner TreeCellRenderer for rendering and editing:
TreeTableCellRenderer extends JTree implements TableCellRenderer {..... JTreeTable.this.repaint();
// this renders and edits basic component (string-based values)
}

2. MyTreeRenderer extends JPanel implements TreeCellRenderer{
// this updates the coloring of labels (used to present tree-nodes) a/c to some condition.
}
This is set externally based on condition.

Each row of JTreeTable needs to be colored according to specific condition that is identified in GroupByTreeRenderer. (A collection that mantains the latest set of colors for all rows based on tree node expantion etc. is updated here)

The problem I am facing here is TreeTableCellRenderer finishes job even before the color gets updated by MyTreeRenderer (b'cos tree's within table? ) so the entire cell is not colored unless I call JTreeTable.this.repaint() in side JTreeTableCellRenderer.getTableCellRendererComponent ( which is a performace hit)

Is there any better way repaint on particular cell of JTreeTable after its contained label ( from MyTreeRenderer) has changed color property?

I am working with 'property change listener' but that does not ease things like visible selection of a row.
Any better ideas around this?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Chaiti"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our Swing forum...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic