| 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, Firstname firstnameObj) { |
| 9 | setFirstnameObj(firstnameObj); |
| 10 | this.label = new JLabel(); |
| 11 | this.label.setText("Firstname"); |
| 12 | this.textField = new JTextField(length); |
| 13 | this.textField.setText(firstnameObj.getFirstname()); |
| 14 | add(label); |
| 15 | add(textField); |
| 16 | } |
| 17 | |
| 18 | public Firstname getFirstnameObj() { |
| 19 | return firstnameObj; |
| 20 | } |
| 21 | |
| 22 | public void setFirstnameObj(Firstname firstnameObj) { |
| 23 | this.firstnameObj = firstnameObj; |
| 24 | } |
| 25 | } |