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 ?
posted 15 years ago
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.