Add some basic data for the Origin class and implement the associated view to allow...
[Persons_Comparator.git] / src / OriginView.java
index 2fc4189df734149123d81aba4f2ed3a0c491190e..a5df1ad987e4e353ad939763d51856f2c1f0bfc0 100644 (file)
@@ -1,13 +1,23 @@
 import javax.swing.*;
 
-public class OriginView extends JComponent {
+public class OriginView extends JPanel {
     private Origin originObj;
-
-    OriginView() {
-    }
+    private JLabel label;
+    private JComboBox<String> comboBox;
+    //FIXME: this label should be refreshed on country selection.
+    private JLabel continentLabel;
 
     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);
+        add(comboBox);
+        add(continentLabel);
     }
 
     public Origin getOriginObj() {