1 import javax
.imageio
.ImageIO
;
5 import java
.io
.IOException
;
7 public class PersonLeftPanel
extends JPanel
{
8 private JLabel leftLabel
= new JLabel();
9 private Image personImage
;
12 leftLabel
.setText("Current person");
15 this.personImage
= ImageIO
.read(new File("data/personImage.png"));
16 } catch (IOException e
) {
21 private void draw(Graphics g
) {
23 Graphics2D g2d
= (Graphics2D
) g
;
25 int imageHeight
= 180;
26 g2d
.drawImage(this.personImage
.getScaledInstance(imageWidth
/ 2, imageHeight
/ 2, Image
.SCALE_SMOOTH
), imageWidth
/ 4, imageHeight
/ 4, this);
30 public void paintComponent(Graphics g
) {
31 super.paintComponent(g
);
35 //FIXME: redraw on resizing
37 public void paint(Graphics g) {
42 public void drawEyes(Color color
) {
43 Graphics g
= this.getGraphics();
45 g
.fillOval(50, 50, 6, 3);
46 g
.fillOval(62, 50, 6, 3);
49 public void drawWeight(int weight
) {
50 Graphics g
= this.getGraphics();
51 g
.setColor(Color
.black
);
52 g
.fillOval(44, 76, 30, (weight
* 20) / 600);