API for using XML w / UI and external DB calls

I am looking to see if there is any API that can accomplish the task I am considering. I want to create a tool that allows the user to upload an xml file. I want this XML file to be displayed visually in a GUI. Using the API (I'm assuming) I want to give the user the ability to click on any tag. As soon as the user clicks on the tag, I would like to run a second method that takes that value and runs some other methods. (Other methods include some DB calls, but are not important.)

Iā€™m rather in the dark, not knowing how to do it. I know how to display XML in java swing GUI, but I'm not sure how to allow the user to click on these tags and get the values.

Is an API required for this, or are there some paths within vanilla Java that might allow this? Please give me the API name if you know.

Thank.

+3


source to share


1 answer


You should be able to do this with javax.swing.JTree and javax.swing.event.TreeSelectionListener.



https://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html https://docs.oracle.com/javase/7/docs/api/javax/swing/event/TreeSelectionListener .html

+2


source







All Articles