public class RegionView extends JPanel {
private Region regionObj;
- //private JLabel label;
private JTree tree;
RegionView(Region regionObj) {
for (String continent : regionObj.getContinents()) {
DefaultMutableTreeNode topContinent = new DefaultMutableTreeNode(continent);
- System.out.println(continent.equals("Europe"));
-
if (continent.equals("Europe")) {
ListIterator<Country> iter = regionObj.getCountryArrayListEurope().listIterator();
while (iter.hasNext()) {
Country countryCursor = iter.next();
topContinent.add(new DefaultMutableTreeNode(countryCursor.getName()));
top.add(topContinent);
-
}
} else if (continent.equals("Africa")) {
ListIterator<Country> iter = regionObj.getCountryArrayListAfrica().listIterator();
Country countryCursor = iter.next();
topContinent.add(new DefaultMutableTreeNode(countryCursor.getName()));
top.add(topContinent);
-
}
} else if (continent.equals("Americas")) {
ListIterator<Country> iter = regionObj.getCountryArrayListAmericas().listIterator();
Country countryCursor = iter.next();
topContinent.add(new DefaultMutableTreeNode(countryCursor.getName()));
top.add(topContinent);
-
}
} else if (continent.equals("Asia")) {
ListIterator<Country> iter = regionObj.getCountryArrayListAsia().listIterator();
Country countryCursor = iter.next();
topContinent.add(new DefaultMutableTreeNode(countryCursor.getName()));
top.add(topContinent);
-
}
} else if (continent.equals("Oceania")) {
ListIterator<Country> iter = regionObj.getCountryArrayListOceania().listIterator();
Country countryCursor = iter.next();
topContinent.add(new DefaultMutableTreeNode(countryCursor.getName()));
top.add(topContinent);
-
}
}
}
tree = new JTree(top);
add(tree);
-
}
public void setRegionObj(Region regionObj) {
this.regionObj = regionObj;
-
}
}