Re: Drawing Icons



On Feb 28, 1:07 pm, "Larry A Barowski"
<ThisisLarrybarAtEngDotAuburnDotLearninginstitution> wrote:
"Jason Cavett" <jason.cav...@xxxxxxxxx> wrote in message

news:893c036b-21d5-4e72-abb8-95a454234623@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am working on a tree cell renderer (currently, extends
DefaultTreeCellRenderer) and I want to be able to "draw" the icons as
I need them.

Create your own icon class that implements javax.swing.Icon.
It can draw itself as a composition of sub-images, or entirely
from scratch using drawing primitives.

Great idea, thank you.

I have this pretty much working except for one minor problem...

In order to correctly draw the icon, it appears that I need to know
the size of the icon before I draw it. However, I unfortunately do
not know the width of the icon until later. Is there any way that I
can "draw" the icon and then resize it so the entire thing is
viewable. (Currently, I set the size to 16x16 px, but in some cases
it will need to be 32x16 px.)

Thanks again for your help, Larry.
.



Relevant Pages