as a small vacation project I am programming a small application that keeps track of episodes of shows (like Friends, Big Bang Theory etc) I have watched. Something like myepisodes, but offline and simpler.
So the user can add shows, seasons and individual episodes. I would make the main window like this:
- On the left side there is a tree structure with the s开发者_运维技巧easons -> shows -> episodes
- On the right side more info of a clicked tree element will appear.
This is my first real program with a GUI in Java so I have to look op and learn many new things. My main problem now is that I don't know what kind of Tree structure I should implement. On the Sun- How to use Trees tutorial I learned on how to build a basic tree and about 'dynamically changing a tree'.
My question now is: Is a basic tree good enough, given that at any moment in the program the user can add a new show, with new seasons etc or should I use that dynamically changing tree?
Thanks in advance,
Harm De Weirdt
I don't think it's an either/or proposition: your tree will be changing as the program runs. More critical is your choice of TreeModel
. DefaultTreeModel
will probably suffice; but if you're loading data from elsewhere, you may want to consider another implementation.
So does this mean I have to use the dynamically changing tree?
This is required if you want to add nodes to the tree while the program is running, rather than just retrieve them from an external source during initialization. See also Understanding the TreeModel.
精彩评论