Hello,
I have a painful painting problem when implementing a JTreeTable with a
variable row heights. I have put together some sample code which can be
found <a href="www.geocities.com/dzenyu/treetable">on my site.</a> I
even provide a sample that you can view in order to demonstrate the
problem.
In a nutshell, whenever a row has a height bigger than the default
tree height, the cell that renderers the JTree will display the leaf
item of that row, and below it, it will display the leaf items that
appear on the next row. It may be hard to explain but view my sample
applet href="www.geocities.com/dzenyu/treetable">on my site.</a>
Any pointers, examples etc, will help me a great deal.
Thanks,
Samuel
Rogan Dawes - 25 May 2006 10:08 GMT
> Hello,
>
[quoted text clipped - 15 lines]
>
> Samuel
As far as I recall from the code, it uses a JTree as a TableCellRenderer
to paint the individual cell, and simply chooses a suitable sized
rectangle of the tree to paint a particular cell, using translate() calls.
My suggestion to you would be to use a multi-line TreeCellRenderer for
your tree instance, so that the nodes in the tree that correspond to
taller lines in the table have the same height in the tree.
In this way, the JTree will make suitable gaps above and below your
taller nodes, and you will not see the nodes below.
Hope this helps.
Rogan
Samuel - 25 May 2006 16:02 GMT
Thanks Rogan for your suggestion, but I am already using a multi-cell
TreeCellRenderer for my tree. The code is here:
MultiLineCellRenderer.java
http://www.geocities.com/dzenyu/treetable/src/TreeTable/ui/MultiLineCellRenderer.java
If I were to create a standalone tree and use the same
"MultiLineCellRenderer.java" on that tree it works fine as expected.
However, on JTreeTable it does not seem to work. I am not sure how I
can fix this problem.
Samuel