Add listener to specific events like country selection.
[Persons_Comparator.git] / src / PersonView.java
1 import javax.swing.*;
2 import java.awt.*;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 public class PersonView extends JPanel implements ActionListener {
7 private int width = 400;
8 private int height = 600;
9 private Person personObj;
10 private FirstnameView firstnameView;
11 private OriginView originView;
12 private SizeView sizeView;
13 private WeightView weightView;
14 private EyeView eyeView;
15 private JPanel personPanel = new JPanel();
16 private JButton compareButton = new JButton("Compare");
17 /*private ImageIcon originImage;
18 private ImageIcon personImage;*/
19
20 PersonView(Person personObj) {
21 setPersonObj(personObj);
22 setFirstnameView(new FirstnameView(15, this.personObj.getFirstname()));
23 setOriginView(new OriginView(this.personObj.getOrigin()));
24 setSizeView(new SizeView(this.personObj.getPersonSize()));
25 setWeightView(new WeightView(this.personObj.getWeight()));
26 setEyeView(new EyeView(this.personObj.getEye()));
27
28 this.compareButton.addActionListener(this);
29 JLabel personLabel = new JLabel("Closest person found");
30 personPanel.add(personLabel);
31 setPreferredSize(new Dimension(this.width, this.height));
32 setLayout(new GridLayout(7, 1, 0, 4));
33 add(firstnameView);
34 add(originView);
35 add(sizeView);
36 add(weightView);
37 add(eyeView);
38 add(compareButton);
39 add(personPanel);
40 }
41
42 public Person getPersonObj() {
43 return personObj;
44 }
45
46 public void setPersonObj(Person personObj) {
47 this.personObj = personObj;
48 }
49
50 /**
51 * @return
52 */
53 public FirstnameView getFirstnameView() {
54 return firstnameView;
55 }
56
57 /**
58 * @param firstnameView
59 */
60 public void setFirstnameView(FirstnameView firstnameView) {
61 this.firstnameView = firstnameView;
62 }
63
64 /**
65 * @return
66 */
67 public OriginView getOriginView() {
68 return originView;
69 }
70
71 /**
72 * @param originView
73 */
74 public void setOriginView(OriginView originView) {
75 this.originView = originView;
76 }
77
78 /**
79 * @return
80 */
81 public SizeView getSizeView() {
82 return sizeView;
83 }
84
85 /**
86 * @param sizeView
87 */
88 public void setSizeView(SizeView sizeView) {
89 this.sizeView = sizeView;
90 }
91
92 /**
93 * @return
94 */
95 public WeightView getWeightView() {
96 return weightView;
97 }
98
99 /**
100 * @param weightView
101 */
102 public void setWeightView(WeightView weightView) {
103 this.weightView = weightView;
104 }
105
106 /**
107 * @param eyeView
108 */
109 public void setEyeView(EyeView eyeView) {
110 this.eyeView = eyeView;
111 }
112
113 /**
114 * @return
115 */
116 public EyeView getEyeView() {
117 return eyeView;
118 }
119
120 @Override
121 public void actionPerformed(ActionEvent actionEvent) {
122
123 }
124 }