Re: Drawing Icons



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/>
.



Relevant Pages

  • Drawing Icons
    ... If the tree is displaying a node and the node is in its default state, ... I want to be able to draw what I need so I can ... build up the icon. ...
    (comp.lang.java.programmer)
  • Re: ICONs presentation
    ... Thank you Sharon; I think I understand your response. ... figure out some search terms to use overat Google. ... Did you ever do a search there for "icon"? ...
    (microsoft.public.windowsxp.customize)
  • Re: CTreeView/CTreeCtrl with Images
    ... I don't know what is in your imagelist either so it could just be blank if the icon is not filled out. ... // TODO: Add extra initialization here ... // TODO: Add your control notification handler code here ... When a button is clicked a displaying the items in the listview mylistobj. ...
    (microsoft.public.vc.mfc.docview)
  • Re: How popup window from icon in system tray?
    ... > I'm writing an app that is happily displaying itself as an icon in the ... Now, when certain events happen in the system, my app needs ... > pop up a little window right above the system tray, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Urgent problem - Smitfraud.c Trojan
    ... My Desktop wallpaper is displaying ... I am on Windows ... Non of the anti virus software has worked like sophos or the ... | icon for a critical error which we have not seen before and we are suspicious ...
    (microsoft.public.windowsxp.security_admin)