posted 18 years ago
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?