Commit | Line | Data |
---|---|---|
089fcbfc JB |
1 | import javax.swing.*; |
2 | ||
d119e60d | 3 | public class OriginView extends JPanel { |
6977e614 | 4 | private Origin originObj; |
883508ca | 5 | private JLabel label; |
1a2ddb85 JB |
6 | private JComboBox<String> comboBox; |
7 | //FIXME: this label should be refreshed on country selection. | |
8 | private JLabel continentLabel; | |
6977e614 | 9 | |
b974e749 JB |
10 | OriginView(Origin originObj) { |
11 | setOriginObj(originObj); | |
883508ca JB |
12 | this.label = new JLabel(); |
13 | this.label.setText("Origin"); | |
1a2ddb85 JB |
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() + ")"); | |
883508ca | 18 | add(label); |
1a2ddb85 JB |
19 | add(comboBox); |
20 | add(continentLabel); | |
089fcbfc JB |
21 | } |
22 | ||
6977e614 JB |
23 | public Origin getOriginObj() { |
24 | return originObj; | |
25 | } | |
26 | ||
27 | public void setOriginObj(Origin originObj) { | |
28 | this.originObj = originObj; | |
29 | } | |
30 | } |