X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FFirstnameView.java;h=b7b85680290a51ca5c6c28e21bf1c92db3cdd3fe;hb=d119e60d58d8431de3ff29090d7048b0eb7d9f9e;hp=3ff29770357320cdeaff4b132cbc0208c6878874;hpb=883508cad71557d375580ce52a4e093f131405db;p=Persons_Comparator.git diff --git a/src/FirstnameView.java b/src/FirstnameView.java index 3ff2977..b7b8568 100644 --- a/src/FirstnameView.java +++ b/src/FirstnameView.java @@ -1,17 +1,16 @@ import javax.swing.*; -public class FirstnameView extends JComponent { +public class FirstnameView extends JPanel { private Firstname firstnameObj; private JTextField textField; private JLabel label; - FirstnameView(int length) { + FirstnameView(int length, Firstname firstnameObj) { + setFirstnameObj(firstnameObj); this.label = new JLabel(); this.label.setText("Firstname"); this.textField = new JTextField(length); - if (firstnameObj != null) { - this.textField.setText(this.firstnameObj.getFirstname()); - } + this.textField.setText(firstnameObj.getFirstname()); add(label); add(textField); }