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);
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() {