From: Jérôme Benoit Date: Sat, 12 Jan 2019 12:46:45 +0000 (+0100) Subject: But all person displaying related information into the View and add a panel for the... X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bb6c655ae5fafc833209b3950b3e69e8f539a42a;p=Persons_Comparator.git But all person displaying related information into the View and add a panel for the closest person found. Signed-off-by: Jérôme Benoit --- diff --git a/src/MainWindowsView.java b/src/MainWindowsView.java index 58a37fb..85470ff 100644 --- a/src/MainWindowsView.java +++ b/src/MainWindowsView.java @@ -11,7 +11,7 @@ public class MainWindowsView extends JFrame { MainWindowsView(String title, JPanel panel) { //Create and set up the window. setTitle(title); - setSize(400, 300); + setSize(panel.getPreferredSize()); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/src/PersonView.java b/src/PersonView.java index 53816af..675f37f 100644 --- a/src/PersonView.java +++ b/src/PersonView.java @@ -1,26 +1,39 @@ import javax.swing.*; +import java.awt.*; public class PersonView extends JPanel { + private int width = 400; + private int height = 600; private Person personObj; private FirstnameView firstnameView; private OriginView originView; private SizeView sizeView; private WeightView weightView; private EyeView eyeView; + private JPanel personPanel = new JPanel(); + private JButton compareButton = new JButton("Compare"); + /*private ImageIcon originImage; + private ImageIcon personImage;*/ PersonView(Person personObj) { setPersonObj(personObj); - setFirstnameView(new FirstnameView(10, this.personObj.getFirstname())); + setFirstnameView(new FirstnameView(15, this.personObj.getFirstname())); setOriginView(new OriginView(this.personObj.getOrigin())); setSizeView(new SizeView(this.personObj.getPersonSize())); setWeightView(new WeightView(this.personObj.getWeight())); setEyeView(new EyeView(this.personObj.getEye())); + JLabel personLabel = new JLabel("Closest person found"); + personPanel.add(personLabel); + setPreferredSize(new Dimension(this.width, this.height)); + setLayout(new GridLayout(7, 1, 0, 4)); add(firstnameView); add(originView); add(sizeView); add(weightView); add(eyeView); + add(compareButton); + add(personPanel); } public Person getPersonObj() {