Questions tagged [defaulttreemodel]

A DefaultTreeModel is a default implementation for displaying JTree data in Java Swing.

DefaultTreeModel is a class in the javax.swing.tree package. It is the default implementation model for displaying data to be represented by a JTree.

23 questions
0
votes
0 answers

Resolve dependency among custom objects

I have a List and each Object has integer 'id' and integer 'depends' parameter. This list then goes for some processing such that the objects which are not dependent on anyone will do the processing first and then next group of objects go…
sg0309
  • 1
  • 1
  • 3
0
votes
1 answer

static filtering of a JTree/ multiple Jtrees sharing (the relevant parts of) a model

I have a Jtree With two top children Say A and B. Currently the code is designed to show both in the same panel as they are part of a shared JTree. What I want to do is, seperate A and Binto two different panels. Now, the Jtree has a complicated…
user1820845
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
1 answer

How to insert and display new node in a JTree of the file system contents

I have successfully created a small program that will display the file system contents in a JTree. It shows only folders and plain text files by design. I would now like to add a folder to the tree when it is created. The example program will…
meyerjp3
  • 197
  • 1
  • 3
  • 16
0
votes
1 answer

JTree node not removed from DefaultTreeModel

I have created a custom DefaultMutableTreeNode.Now I want to perform Drag and drop on the tree it is working fine but I want to remove the node after being dropped. But the thing is I can insert node into model but can't remove from model. public…
Madhan
  • 5,750
  • 4
  • 28
  • 61
0
votes
1 answer

JTree display issue

I dont know much about java. I wrote this code in JTree but when I run the program JTree just shows the last fList. Is there anything tha I can add to the code so that JTree display all of them? JTreeCode is another class in the same package. File…
Kiki
  • 75
  • 1
  • 1
  • 7
0
votes
0 answers

JTree doesn't show changes after insertNodeInto

I have a JTree which needs to be populated as the data is being loaded. I create tree with DefaultTreeModel final DefaultTreeModel treeModel = new DefaultTreeModel(root); jTree1 = new JTree(treeModel); Where root is a MutableTreeNode…
Dia
  • 271
  • 1
  • 13
-1
votes
4 answers

Create JTree using data from text file

How can I create a JTree using data from a .txt file? The text file is formatted as follows: Root Node Category A Sub-Category A1 Item A1.0 Item A1.1 Item A1.2 …
engineervix
  • 345
  • 2
  • 6
  • 17
1
2