I’m creating an app with JTabbedpane and I made a function that adds tabs with a click of a button. The tabs contain JTrees. After I add tabs I want to be able to add nodes to the trees in the tabs.
Now, because tabs and trees are created programmatically, how can I access a specific JTree in a specific tab so I can add nodes to it?
Thanks in advance.
You should have class that extends tab instead of working directly with the concrete Tab, and have methods that add/get a tree from it. So you create an instance of tab, you create the tree, then you add it to the tab. If you don’t know how many tabs that will be created, keep them in a list.