import javax.swing.*;
-public class OriginView extends JComponent {
+public class OriginView extends JPanel {
private Origin originObj;
private JLabel label;
+ private JComboBox<String> comboBox;
+ //FIXME: this label should be refreshed on country selection.
+ private JLabel continentLabel;
- OriginView() {
+ OriginView(Origin originObj) {
+ setOriginObj(originObj);
this.label = new JLabel();
this.label.setText("Origin");
+ this.comboBox = new JComboBox<>(this.getOriginObj().getCountriesArray());
+ this.comboBox.setSelectedItem(this.getOriginObj().getCountry());
+ this.continentLabel = new JLabel();
+ this.continentLabel.setText("(" + this.getOriginObj().getContinent() + ")");
add(label);
- }
-
- OriginView(Origin originObj) {
- setOriginObj(originObj);
+ add(comboBox);
+ add(continentLabel);
}
public Origin getOriginObj() {