Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2006

Tip: Looking for answers? Try searching our database.

Help with Painting problem of a variable row height JTreeTable

Thread view: 
Samuel - 25 May 2006 00:48 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.