public void valueChanged(ListSelectionEvent listSelectionEvent) {
Eye currentEye = new Eye((String) getColorsList().getSelectedValue());
PersonLeftPanel personLeftPanel = MainWindowsView.getInstance().getCurrentPersonView().getPersonPanel().getLeftPanel();
+ personLeftPanel.drawEyes(currentEye.getColor());
}
private static class EyeCellRenderer extends DefaultListCellRenderer {
super.paintComponent(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);
}
+
+ public void drawEyes(Color color) {
+ Graphics g = this.getGraphics();
+ g.setColor(color);
+ g.fillOval(50, 50, 6, 3);
+ g.fillOval(62, 50, 6, 3);
+ }
}
return personImage;
}
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
+ public void drawPerson(Person personObj) {
+ Graphics g = this.getGraphics();
// Draw
- g.setColor(Color.black);
- g.drawString(getContentText(), 5, 35);
+ g.drawString(getContentText(), 12, 35);
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);
+ g.setColor(personObj.getEye().getColor());
+ g.fillOval(50, 50, 6, 3);
+ g.fillOval(62, 50, 6, 3);
}
}
//Utils.displayArrayList(personArrayList);
Person closestPerson = personArrayList.get(personArrayList.indexOf(this.getPersonObj()) + 1);
personPanel.setRightContentText(closestPerson.getFirstname().getFirstname() + " at distance " + closestPerson.getDistanceFromReference());
+ personPanel.getRightPanel().drawPerson(closestPerson);
}
}
}