Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree not updating after removing node and cant get background to change...

 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so when I remove a node from the JTree it does repaint how it's suppose to even after a call to repaint. This is what I did..


I've also tried repaint(), updateUI(), revalidate() and nothing seems to work. It removes the node but still half-@$$ draws whats left. however if I remove the jtree and put it back on the screen the nodes are gone that I've removed.

Also another thing I can't figure out is how to change the background of the jtree or simply set it to transparent. setOpaque(false) simply gets me a gray background, and I want no colors at all...just straight through to the background...any ideas?
 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I figured out the problem to my first question... Simply grad the treeModel like so..



And that did it. However I can't seem to find anywhere to change the background of the JTree... Any ideas?

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> how to change the background of the jtree or simply set it to transparent.

set a cellRenderer and use (along with opaque(false))
setBackgroundNonSelectionColor(new Color(0,0,0,0));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic