This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!