TreeCellRenderer

A

Aaron Fude

Hi,

I have largely figured out how to us a custom TreeCellRenderer, but I
can't figure out how to make the tree let my custom Components take more
space. I create an JPanel that's about 100x100, but when displayed, only
a small portion of it is displayed, as if it were just a small label.

Any ideas on how to fix it?

Thanks,

Aaron
 
M

markspace

Aaron said:
Hi,

I have largely figured out how to us a custom TreeCellRenderer, but I
can't figure out how to make the tree let my custom Components take more
space. I create an JPanel that's about 100x100, but when displayed, only
a small portion of it is displayed, as if it were just a small label.

Any ideas on how to fix it?


I made a TreeCellRenderer that displays thumbnails of .jpgs on my hard
disc. I just made an ImageIcon and put it in a JLabel. Each row of the
JTree can be a different size as a result (the ImageIcon is scaled to be
have the same proportions as the original image) and it works fine.

I'd guess this has something to do with returning "getPreferredSize" and
related methods correctly.

I think we'll need an SSCCE if you continue to have issues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,815
Messages
2,569,702
Members
45,494
Latest member
KandyFrank

Latest Threads

Top