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