Jtree to jpanel

I have a JTree object that uses DefaultTreeModel as a model, and I add / remove nodes relative to this model.

At this point, I need to show the tree structure in a graphical interface, such as JPanel . How can I map DefaultTreeModel elements to a JPanel object? In other words, how to draw JTree objects into a JPanel object. Since the tree can be modified, the implementation must reflect the changes.

Thank you for your concern.

+4
source share
1 answer

Sort of:

 JPanel p = new JPanel(new BorderLayout()); JScrollPane sp = new JScrollPane(jtree); p.add(BorderLayout.CENTER, sp); 
+4
source

Source: https://habr.com/ru/post/1391059/


All Articles