Refactor the person drawing code.
[Persons_Comparator.git] / src / PersonRightPanel.java
index 0cf73436b5c8090f9ec1d84f1697a703ed6e356b..62067f6689bc2aa4d47e0e0a4c692b34fb9159ac 100644 (file)
@@ -27,12 +27,16 @@ public class PersonRightPanel extends JPanel {
         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);
@@ -40,8 +44,8 @@ public class PersonRightPanel extends JPanel {
         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);
     }
 }