Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTreeTable: Coloring and Performace: Communicating between 2 renderers

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 force repaint on particular cell of JTreeTable after its contained label ( from MyTreeRenderer) has changed color property?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic