Add a label to all views.
[Persons_Comparator.git] / src / EyeView.java
CommitLineData
089fcbfc
JB
1import javax.swing.*;
2
3public 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);
14 add(label);
15 add(colorsList);
089fcbfc
JB
16 }
17
ac6c3ea2 18 /**
ac6c3ea2
JB
19 * @param eyeObj
20 */
6977e614
JB
21 EyeView(Eye eyeObj) {
22 setEyeObj(eyeObj);
23 }
24
ac6c3ea2 25 /**
ac6c3ea2
JB
26 * @return
27 */
6977e614
JB
28 public Eye getEyeObj() {
29 return eyeObj;
30 }
31
ac6c3ea2 32 /**
ac6c3ea2
JB
33 * @param eyeObj
34 */
6977e614
JB
35 public void setEyeObj(Eye eyeObj) {
36 this.eyeObj = eyeObj;
37 }
38}