DefaultMutableTreeNode is the base class used by Java to display content in a Swing based JTree.
Questions tagged [defaultmutabletreenode]
27 questions
0
votes
1 answer
Dynamically add nodes in an JTree
i have got a problem to add nodes dynamically to my JTree.
I receive my JTree Informations via a RestAPI in json Format.
The informations i need are the folderID and the folderName.
The folderID structure is like that:
1
1.1
6.8
7.1.1.1
1.2
etc.
So…

Boki
- 1
- 3
0
votes
1 answer
TreeView nodes names bugging
I'm having a lot of trouble dealing with TreeView, more specificcaly with the text shown per node.
Starting with an initializer for the Tree, where I expected a single node with the text, it might make the program more intuitive for the…

Felipe Hogrefe Bento
- 187
- 15
0
votes
0 answers
Select the TreeNode before (java swing, tree)
I am looking for a way to select the TreeNode before the actually selected node (if no Node is selected, the first Node AFTER the root should be selected) on Button click. I am basically having a Hashtable ht and a JTree filled with nodes (all Nodes…

Rüdiger
- 893
- 5
- 27
- 56
0
votes
2 answers
How to find a node in a tree given a path
I have a TreeModel in java and I'm given a path to find to check if the path exists. For example /dir1/dir2/dir3/ is an existing path in my tree. My tree is non binary. How would I approach this? My idea was to have the function take a…

user1995933
- 209
- 1
- 3
- 7
0
votes
1 answer
JTree add child to child to child etc
i have a problem with my first jtree :-/
i have a list of nodes, like this:
List allNodes = new ArrayList();
and now i have to create a tree
if i loop over the nodes and create my tree, it looks…

NVD
- 15
- 5
0
votes
1 answer
JTree representing a graph
I am using the JTree Swing utility to represent a Tree that actually have loops. I have a single node called root, but some of the children will eventually point back to other parts of the tree, thus not making it a true tree, but rather a graph.
My…

Matthew
- 3,886
- 7
- 47
- 84
0
votes
0 answers
How to traverse all nodes of a TreePath recursively
I am trying to create a method that go through all nodes of a path. it will be used for a JTree and nodes will be files and folders. So it must go through the folders as well.
Here is my code:
Main setup:
DefaultMutableTreeNode root = new…

Alex
- 255
- 2
- 5
- 10
0
votes
0 answers
How to check 'selected' of an item in JCheckBoxTree after pressing the button
I have a customised JCheckBoxTree which its code is taken from this source.
So I want to have access to the status of each CheckBox of this tree. For example, I want to set an item of the tree as 'SELECTED' by pressing a button. I think I need to…

Alex
- 255
- 2
- 5
- 10
0
votes
1 answer
ClassCastException while Drag and Drop in a JTree
I want to make drag and drop in JTree. I follow this tutorial:
http://www.java2s.com/Code/Java/Swing-JFC/DnDdraganddropJTreecode.htm
Unfortunately I have in JTree nodes with my own class and when I want to drag then I got this…

rizon
- 13
- 6
0
votes
1 answer
isRoot() in DefaultMutableTreeNode
Why there is an isRoot() function in DefaultMutableTreeNode? I ask because I have a Class that extends DefaultMutableTreeNode. I would like to be able to use a single instance of this class in multiple different JTree objects. However, it would seem…

user3058135
- 3
- 1
0
votes
1 answer
JTree avoid collapse after reload
I'm trying to find a solution the problem of collapse in JTree after reload it.
The situation:
JTree
[-] Office A
|---[-] Office A.1
| |---[-] Office A.1.1
| |---[-] Office A.1.2
[-] Office B
|---[-] Office B.1
| |---[-] Office B.1.1
…

Fry
- 6,235
- 8
- 54
- 93
-1
votes
1 answer
JTree displaying drive does not show up at all
My task is to show a tree of all directories/files of a PC drive,
I have a class DirectoryNode that extends DefaultMutableTreeNode with File field directoryPath. I build nodes recursively:
public void buildDirectoryTree(){
…

TheSmokingGnu
- 302
- 2
- 6
- 15