Trying to make a tree list

Hi, I am trying to create a tree list to contribute at some point. Right now I am implementing it with a button for each of the elements, which are each “node” in the tree. Is this a good way of doing this? I am looking for some suggestions as to how I should do this.

Thanks,
Davis

You should avoid having an object per node (except perhaps when the node is on screen) as that would become an issue in the case of a really massive tree.

Swing for example when doing things like lists/tables/etc lets you provide a control that acts as a template. That control is then repeatedly used to render each row.

That wouldn’t work in this case but still you are most likely best off only adding visible objects for nodes that are actually visible.