Commit | Line | Data |
---|---|---|
089fcbfc JB |
1 | import javax.swing.*; |
2 | ||
3 | public class EyeView extends JComponent { | |
6977e614 | 4 | private Eye eyeObj; |
883508ca | 5 | private JLabel label; |
d75d0a00 | 6 | private JComboBox colorsList; |
6977e614 | 7 | |
b974e749 JB |
8 | /** |
9 | * @param eyeObj | |
10 | */ | |
11 | EyeView(Eye eyeObj) { | |
12 | setEyeObj(eyeObj); | |
883508ca JB |
13 | this.label = new JLabel(); |
14 | this.label.setText("Eyes color"); | |
d75d0a00 JB |
15 | this.colorsList = new JComboBox<>(this.getEyeObj().getColorsList()); |
16 | if (this.getEyeObj().getStrColor() != null) | |
17 | this.colorsList.setSelectedItem(this.getEyeObj().getStrColor()); | |
883508ca JB |
18 | add(label); |
19 | add(colorsList); | |
089fcbfc JB |
20 | } |
21 | ||
ac6c3ea2 | 22 | /** |
ac6c3ea2 JB |
23 | * @return |
24 | */ | |
6977e614 JB |
25 | public Eye getEyeObj() { |
26 | return eyeObj; | |
27 | } | |
28 | ||
ac6c3ea2 | 29 | /** |
ac6c3ea2 JB |
30 | * @param eyeObj |
31 | */ | |
6977e614 JB |
32 | public void setEyeObj(Eye eyeObj) { |
33 | this.eyeObj = eyeObj; | |
34 | } | |
35 | } |