How can i access the subnode in Jtree - java

anyone help me i have Jtree and Subnode i want to click sub node and display one window form in java am using netbeans.

You can achieve this by using a tree selection listener. Look at How to Use Trees tutorial. In particular, Responding to Node Selection section describes how to implement a basic selection listener.

Related

expand tree to currently created node level in java swt

It would be very useful to expand a JFace tree viewer in java swt as follows:
whenever a new node is added to the tree, the tree viewer expands only the currently added node in the tree (and its children if any).
I have used the expandToLevel(getIndex()) method, but this does not expands the children of the currently added node if any.
Thank you in advance for any hints and for your interest.

Custom Java Swing XML Editor

I need to show an xml as a tree structure in a java swing application. When I click on any node in the swing tree its attribute should list in a window (like a properties editor) and from that I need to update the attributes. Also I need to hide some nodes in the xml in the tree.
I am planning to use JTree to populate and show the xml as tree. But bit confused about what approach need to take to read/update the xml.
Currently I have the below options:
Using JAXB create the corresponding objects and populate the JTree
Use any parser DOM or SAX and populate the JTree using the DefaultMutableTreeNode
Please advice what approach I need to proceed? or is there any other better way for doing this?

JTree Drag and Drop: drag nodes with its childs

I would like to add drag and drop feature to my JTree.
I have tried to run example from this thread. It works but it works only on last leaves in tree, not on nodes that contain some childs. I have also looked on this thread.
I have defined canImport and importData methods, and also have set setDragEnabled(true). I just cannot drag nodes also with its childs.
How to edit example from first link to drag also nodes with its childs? As I understand correctly, I should set DataFormat instance, to set what types should be dragged.
Can anybody help?

How to create inverted JTree in Java?

Actually I'm interested to create an inverted JTree in Java in such a way that root exists at top and its child nodes at the next level and so on. As we know in case of simple JTree the child nodes appears expanding on the right side of the parent node but I want to implement inverted JTree in my project where child nodes expands downwards which gives an appearance of "TREE" type of data structure.
As this is very essential for my project so can anyone suggest me the code for the above mentioned problem?
Thanks in advance.
Then JTree is not the correct choice. Perhaps, you should look into Java2D and stuff like that.

Rich faces tree refresh selected node

Can someone provide me a working example of rich tree which refreshes it's nodes, when there is a new child added or removed. It should be done using ajaxKeys attribute, but I can't find any working examples on it.
Thanks in advance

Categories