Refactor the person drawing code.
[Persons_Comparator.git] / src / PersonLeftPanel.java
index a7022fb9460de77364a9016d7797982768ec164d..d01abd000b1ef5ee56f946d2d034e2f9cc6f53dd 100644 (file)
@@ -18,14 +18,31 @@ public class PersonLeftPanel extends JPanel {
         }
     }
 
-    public void paintComponent(Graphics g) {
-        super.paintComponent(g);
-
+    private void draw(Graphics g) {
         // Draw
-        g.setColor(Color.black);
         Graphics2D g2d = (Graphics2D) g;
         int imageWidth = 120;
         int imageHeight = 180;
         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);
+        g.fillOval(50, 50, 6, 3);
+        g.fillOval(62, 50, 6, 3);
+    }
 }