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