Add a label to all views.
[Persons_Comparator.git] / src / FirstnameView.java
1 import javax.swing.*;
2
3 public class FirstnameView extends JComponent {
4 private Firstname firstnameObj;
5 private JTextField textField;
6 private JLabel label;
7
8 FirstnameView(int length) {
9 this.label = new JLabel();
10 this.label.setText("Firstname");
11 this.textField = new JTextField(length);
12 if (firstnameObj != null) {
13 this.textField.setText(this.firstnameObj.getFirstname());
14 }
15 add(label);
16 add(textField);
17 }
18
19 public Firstname getFirstnameObj() {
20 return firstnameObj;
21 }
22
23 public void setFirstnameObj(Firstname firstnameObj) {
24 this.firstnameObj = firstnameObj;
25 }
26 }