I have a HashMap that looks like this:
HashMap<CauseCategory, ArrayList<Cause>> data;
CauseCategory and Cause are just classes with one string instance fields in them, set by their constructors or setter methods (if needed). Now, the system fetches a bunch of cause categories from the database, and for each cause catagory there are a number of causes associated with it.
Say we have a cause category "technical", it would have multiple causes associated with it, such as "packaging problem", "processing error", "miscalculation error", and so on.
I feed my GUI class this HashMap, which has two JComboBoxes (Cause Categories + Cause Descriptions).
How can I bind the first combobox (categories) so that when I select one item from that list, it only shows the causes associated with it in the second combobox (cause descriptions)?
EDIT: It may be simplier to think of the hashmap like this:
HashMap<String, ArrayList<String>> data;