Re: Drawing Icons
- From: Jason Cavett <jason.cavett@xxxxxxxxx>
- Date: Thu, 28 Feb 2008 15:26:27 -0800 (PST)
On Feb 28, 5:35 pm, Daniel Pitts
<newsgroup.spamfil...@xxxxxxxxxxxxxxxxxxx> wrote:
Jason Cavett wrote:
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. Here's an explanation of what I mean.
If the tree is displaying a node and the node is in its default state,
I want this:
[Icon]
If the tree is displaying a node and the node is "opened":
[Icon]
If the tree is displaying a node and the node is "opened" and has a
note attached:
[Icon{n}]
Basically, I want to be able to draw what I need (on the fly) so I can
build up the icon. I do realize I could just create every possible
icon and display the right one depending on the state of the
underlying node, but that seems to be very inefficient, especially as
I add more nodes.
Hopefully this message makes sense. Can anybody provide any insight?
You can create an Icon for every state that node can have (which looks
like three from here). You should create an image (for example a png
image) for those states, and then use ImageIcon()
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
That's what I was doing originally. However, due to new requirements
the number of icons are going to at least double. Additionally, since
the application will (most likely) be skinned in the future, I don't
want to have to make 6 times the amount of icons. It *should* be
easier to just build each icon as I need it. And, it works (see my
other posts), except for the fact that the text is overtop the icon
within the JTree and I can't figure out how to shift it over. (This
seeemingly happened automatically when I was using an ImageIcon.)
.
- References:
- Drawing Icons
- From: Jason Cavett
- Re: Drawing Icons
- From: Daniel Pitts
- Drawing Icons
- Prev by Date: Nowbie in the java jungle
- Next by Date: Re: JAX-WS - Turning on outgoing SOAP headers for client
- Previous by thread: Re: Drawing Icons
- Next by thread: Process instances in JBI BPEL module
- Index(es):
Relevant Pages
|
|