tags:

views:

40

answers:

1

Hello everyone,

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 seasons -> 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

+1  A: 

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.

trashgod
So does this mean I have to use the dynamically changing tree? And I will be loading data from elsewhere, since everytime the program loads I'll need to reload the database. I haven't decided how I'll save the user's collection yet.. I was thinking about saving in an xml format so that I could easily export in a html format or something..
Harm De Weirdt
@Harm De Weirdt: I think so; I've elaborated above.
trashgod