No, you should get it from the Database each time - so that itbecomes independent of the database, i.e., any additions to the database will automatically reflect in your search. Its quite straightforward - get the record - get value - in array - get the appropriate index value - put in a collection to eliminate duplicates - add 'any' to the list and pass it to a combo box constructor
Well, I hard coded the values for my to and from combo boxes and I still got a perfect score on the GUI section. I agree that this is not the best way to do this. If any new airport codes are added the GUI will have to be modified. However, if you perform a lookup to read every record from the database and get this list you could have performance problems. Specifically, if the database becomes very large and there are still only a few unique airport codes a lot of time will be wasted reading in duplicate codes. Just something to think about. ------------------
I think your question is really, "Should I hard code the names of the database fieldnames in the gui". The answer would be that you should put the column names in a constant somewhere. They have to be hard coded somewhere. Of course if your question is "Should I hard code the cities that can be selected", then the answer is no. The way I did it was on startup to get all list of all of the city names using a TreeSet class. Then you could also provide a way for the user to refresh this list from a menu.
Whose rules are you playing by? This tiny ad doesn't respect those rules:
Devious Experiments for a Truly Passive Greenhouse!