Extending DefaultTreeCellRenderer, setOpaque has no effect
Hello
I'm building a JTree and want the tree and all its nodes to not be opaque, i.e. when I have a background image, the image should be visible.
When I have searched the forum for this subject I came across another thread with some suggestions on the DefaultTreeCellRenderer but the suggestions did not seem to work for the guy who made the post.
The code below works somewhat, i.e. the tree is clear and the selected nodes/leafs are clear but not the nonselected nodes/leafs.
publicclass PrefsTreeCellRendererextends DefaultTreeCellRenderer{
public PrefsTreeCellRenderer(){
super();
}/* PrefsTreeCellRenderer */
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel,boolean expanded,boolean leaf,int row,boolean hasFocus){
super.getTreeCellRendererComponent(
tree, value, sel, expanded, leaf, row, hasFocus);
this.setBackgroundSelectionColor(null);
this.setBorderSelectionColor(null);
this.setBackgroundNonSelectionColor(null);// Seems not to be working.
returnthis;
}/* getTreeCellRendererComponent */
}/* PrefsTreeCellRenderer */
I'd appreciate any suggestions on this.
aqd

