X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FEye.java;h=edaea1bb467c07f00a510e155804a25c7b952114;hb=9b3bfcdd95253a04ed12a676ee29a9d777c1e496;hp=6b71f354d6cd9e3d8a7bb043680efda045a1b573;hpb=d75d0a00d45e0f62b494a7282a5902e63df32b1a;p=Persons_Comparator.git diff --git a/src/Eye.java b/src/Eye.java index 6b71f35..edaea1b 100644 --- a/src/Eye.java +++ b/src/Eye.java @@ -27,7 +27,7 @@ public class Eye implements Comparable { if (validateColor(strColor)) { this.strColor = strColor; } else { - throw new IllegalArgumentException("Color must be" + new Eye().colorListToString()); + throw new IllegalArgumentException("Color must be" + this.colorListToString()); } } @@ -47,13 +47,16 @@ public class Eye implements Comparable { */ public void setColor(String color) { if (validateColor(color)) { - if (color.equals("brown")) + if (color.equals("black")) + this.color = Color.black; + else if (color.equals("blue")) + this.color = Color.blue; + else if (color.equals("brown")) this.color = new Color(88, 41, 0); - else - this.color = Color.getColor(color); - + else if (color.equals("green")) + this.color = Color.green; } else { - throw new IllegalArgumentException("Color must be" + new Eye().colorListToString()); + throw new IllegalArgumentException("Color must be" + this.colorListToString()); } }