1 import javax
.imageio
.ImageIO
;
5 import java
.io
.IOException
;
7 public class PersonRightPanel
extends JPanel
{
8 private JLabel rightLabel
= new JLabel();
9 private String contentText
= new String();
10 private Image personImage
;
13 rightLabel
.setText("Closest person found");
16 this.personImage
= ImageIO
.read(new File("data/personImage.png"));
17 } catch (IOException e
) {
22 public void setContentText(String contentText
) {
23 this.contentText
= contentText
;
26 public String
getContentText() {
30 //FIXME: redraw on resizing
32 public void paint(Graphics g) {
37 public void drawPerson(Person personObj
) {
38 Graphics g
= this.getGraphics();
39 g
.clearRect(0, 25, getWidth(), getHeight());
42 g
.drawString(getContentText(), 12, 35);
43 Graphics2D g2d
= (Graphics2D
) g
;
45 int imageHeight
= 180;
46 g2d
.drawImage(this.personImage
.getScaledInstance(imageWidth
/ 2, imageHeight
/ 2, Image
.SCALE_SMOOTH
), imageWidth
/ 4, imageHeight
/ 4, this);
48 g2d
.setColor(personObj
.getEye().getColor());
49 g2d
.fillOval(50, 50, 6, 3);
50 g2d
.fillOval(62, 50, 6, 3);
52 g2d
.setColor(Color
.black
);
53 g2d
.fillOval(44, 76, 30, (personObj
.getWeight().getWeight() * 20) / 600);