Skip to content
Snippets Groups Projects
Verified Commit 87c29122 authored by Biryuk, Volodymyr's avatar Biryuk, Volodymyr
Browse files

Change the order of colors added to FARBEN

The order of colors being added to the map now matches the order
of the keys in the map. This was necessary because students would
get confused when the order given by the .values() method would
differ form the addition order.
parent 73fb5d5a
No related branches found
No related tags found
1 merge request!2Refactor colors
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -12,6 +12,7 @@ import javax.swing.JFrame; ...@@ -12,6 +12,7 @@ import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.HashMap; import java.util.HashMap;
import java.util.TreeMap;
/** /**
* Diese Klasse definiert Turtles, die mit einfachen * Diese Klasse definiert Turtles, die mit einfachen
...@@ -58,19 +59,19 @@ public class Turtle ...@@ -58,19 +59,19 @@ public class Turtle
static static
{ {
FARBEN = new HashMap<String, Color>(); FARBEN = new HashMap<String, Color>();
FARBEN.put("hellgrau", Color.LIGHT_GRAY);
FARBEN.put("magenta", Color.MAGENTA);
FARBEN.put("pink", Color.PINK);
FARBEN.put("gelb", Color.YELLOW);
FARBEN.put("schwarz", Color.BLACK); FARBEN.put("schwarz", Color.BLACK);
FARBEN.put("blau", Color.BLUE); FARBEN.put("weiss", Color.WHITE);
FARBEN.put("cyan", Color.CYAN); FARBEN.put("cyan", Color.CYAN);
FARBEN.put("dunkelgrau", Color.DARK_GRAY);
FARBEN.put("grau", Color.GRAY); FARBEN.put("grau", Color.GRAY);
FARBEN.put("gruen", Color.GREEN); FARBEN.put("blau", Color.BLUE);
FARBEN.put("hellgrau", Color.LIGHT_GRAY);
FARBEN.put("magenta", Color.MAGENTA);
FARBEN.put("orange", Color.ORANGE); FARBEN.put("orange", Color.ORANGE);
FARBEN.put("pink", Color.PINK); FARBEN.put("gruen", Color.GREEN);
FARBEN.put("rot", Color.RED); FARBEN.put("rot", Color.RED);
FARBEN.put("weiss", Color.WHITE); FARBEN.put("dunkelgrau", Color.DARK_GRAY);
FARBEN.put("gelb", Color.YELLOW);
FARB_ARRAY = FARBEN.values().toArray(new Color[FARBEN.size()]); FARB_ARRAY = FARBEN.values().toArray(new Color[FARBEN.size()]);
} }
...@@ -82,6 +83,8 @@ public class Turtle ...@@ -82,6 +83,8 @@ public class Turtle
public Turtle() public Turtle()
{ {
this(TurtleWelt.WIDTH / 2, TurtleWelt.HEIGHT / 2); this(TurtleWelt.WIDTH / 2, TurtleWelt.HEIGHT / 2);
System.out.println(FARBEN);
System.out.println(FARBEN.keySet());
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment