Collapse « JTree « Java Swing Q&A





1. JTree avoid collapse node when update the tree    stackoverflow.com

I'm using a tree table object (the example taken from the sun site)..I would prevent the collapse of the tree nodes when I update the model, because it's boring to re-expand ...

2. collapsing JTree    coderanch.com

Hi all, Before you think I have been lazy and not done a search on previous posts, believe me I have, but still did not find a solution to my problem...or at least not one that I understand Anyway, here it is: I am using a JTree which is built from a database table. The database can be updated by other ...

3. JTree Node Collapsing    coderanch.com

I would suggest keeping track of all expanded nodes and created a methods that would expand them again after your drag and drop operation. More specifically, the last call in your drag and drop operation would simply call that method and re-expand the nodes that were closed by the action. There are definitely more elegant ways to do this but this ...

4. JTree Nodes Collapsing....    coderanch.com

5. Dont collapse JTree after refresh?    coderanch.com

hi again. i tried your second suggestion without success. :-( here is my example: import javax.swing.*; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import javax.swing.event.TreeModelListener; import javax.swing.event.TreeModelEvent; import javax.swing.event.EventListenerList; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.*; import java.util.HashMap; import java.io.File; import java.io.Serializable; import javax.swing.tree.*; import javax.swing.event.*; public class FileTreeModel implements TreeModel, Serializable, Cloneable { protected EventListenerList listeners; private Map map; private File root; ...

6. Keep a JTree from collapsing    java-forums.org

I don't know if this is a method from the DefaultMutableTreeNode or from the JTree... But whenever I double click a node, it collapses. I don't want the double click to collapse the nodes. I want the tree to be always expanded. More specifically, I want the ROOT node to be always expanded, even if the user double clicks on it ...