}
}
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
-
+ private void draw(Graphics g) {
// Draw
Graphics2D g2d = (Graphics2D) g;
int imageWidth = 120;
g2d.drawImage(this.personImage.getScaledInstance(imageWidth / 2, imageHeight / 2, Image.SCALE_SMOOTH), imageWidth / 4, imageHeight / 4, this);
}
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ draw(g);
+ }
+
+ //FIXME: redraw on resizing
+ /*@Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ draw(g);
+ }*/
+
public void drawEyes(Color color) {
Graphics g = this.getGraphics();
g.setColor(color);
return contentText;
}
- public Image getPersonImage() {
- return personImage;
- }
+ //FIXME: redraw on resizing
+ /*@Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ drawPerson();
+ }*/
public void drawPerson(Person personObj) {
Graphics g = this.getGraphics();
+ g.clearRect(0, 25, getWidth(), getHeight());
// Draw
g.drawString(getContentText(), 12, 35);
int imageWidth = 120;
int imageHeight = 180;
g2d.drawImage(this.personImage.getScaledInstance(imageWidth / 2, imageHeight / 2, Image.SCALE_SMOOTH), imageWidth / 4, imageHeight / 4, this);
- g.setColor(personObj.getEye().getColor());
- g.fillOval(50, 50, 6, 3);
- g.fillOval(62, 50, 6, 3);
+ g2d.setColor(personObj.getEye().getColor());
+ g2d.fillOval(50, 50, 6, 3);
+ g2d.fillOval(62, 50, 6, 3);
}
}