| 1 | import javax.swing.*; |
| 2 | |
| 3 | public class OriginView extends JPanel { |
| 4 | private Origin originObj; |
| 5 | private JLabel label; |
| 6 | private JComboBox<String> comboBox; |
| 7 | //FIXME: this label should be refreshed on country selection. |
| 8 | private JLabel continentLabel; |
| 9 | |
| 10 | OriginView(Origin originObj) { |
| 11 | setOriginObj(originObj); |
| 12 | this.label = new JLabel(); |
| 13 | this.label.setText("Origin"); |
| 14 | this.comboBox = new JComboBox<>(this.getOriginObj().getCountriesArray()); |
| 15 | this.comboBox.setSelectedItem(this.getOriginObj().getCountry()); |
| 16 | this.continentLabel = new JLabel(); |
| 17 | this.continentLabel.setText("(" + this.getOriginObj().getContinent() + ")"); |
| 18 | add(label); |
| 19 | add(comboBox); |
| 20 | add(continentLabel); |
| 21 | } |
| 22 | |
| 23 | public Origin getOriginObj() { |
| 24 | return originObj; |
| 25 | } |
| 26 | |
| 27 | public void setOriginObj(Origin originObj) { |
| 28 | this.originObj = originObj; |
| 29 | } |
| 30 | } |