Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom TreeCellRenderer and invisible nodes  RSS feed

 
Steve Anderson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a custom TreeCellRenderer in which i'm attempting to set some nodes invisible. Simply setting the nodes icon and text to null eliminates the rendering of the node, but the vertical "edge" line shows up when I'm using a linestyle or vertical space is taken up where the node is when I'm not. Does anyone know how to eliminate this vertical line/space usage to create the appearance of no node being there at all ?
 
Steve Anderson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the key to making this work. You must override the cellRenderers getPreferredSize and supply a Dimension(0,0) for those nodes you wich to suppress. Additionally, you MUST set tree.setRowHeight(-1); to allow arbitrary row heights. In the end you don't need to set the icon and text to null, setIcon(null); setText(null); Works like a champ. I'l give me some duke dollars for that.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!