File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTree not updating after removing node and cant get background to change... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree not updating after removing node and cant get background to change..." Watch "JTree not updating after removing node and cant get background to change..." New topic
Author

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

Chris Dancy
Ranch Hand

Joined: Feb 14, 2006
Posts: 136
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?


("Anger is not an emotion, its a symptom of fear.")
Chris Dancy
Ranch Hand

Joined: Feb 14, 2006
Posts: 136
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

Joined: Jun 09, 2003
Posts: 4632
> 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));
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree not updating after removing node and cant get background to change...