• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing:JTreeTable: Coloring and Performace  RSS feed

 
Chaiti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!