Skip to content
Snippets Groups Projects
Commit 448f118b authored by Biryuk, Volodymyr's avatar Biryuk, Volodymyr
Browse files

Merge branch 'bba4495-dev-patch-52153' into 'dev'

Fixed undefined ordering of the Turtle color array to conform to docs of setzeFarbe(int)

See merge request !1
parents 95e443e7 337db5aa
No related branches found
No related tags found
2 merge requests!3Remove redundant colors and method to get colors,!1Fixed undefined ordering of the Turtle color array to conform to docs of setzeFarbe(int)
...@@ -11,8 +11,7 @@ import java.awt.image.BufferedImage; ...@@ -11,8 +11,7 @@ import java.awt.image.BufferedImage;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.TreeMap;
/** /**
* Diese Klasse definiert Turtles, die mit einfachen * Diese Klasse definiert Turtles, die mit einfachen
...@@ -32,8 +31,8 @@ import java.util.TreeMap; ...@@ -32,8 +31,8 @@ import java.util.TreeMap;
* @author Axel Schmolitzky * @author Axel Schmolitzky
* @author Fredrik Winkler * @author Fredrik Winkler
* @author Clara Marie Lueders * @author Clara Marie Lueders
* @author Volodymyr Biryuk * @author Lasse Huber-Saffer
* @version 29. November 2023 * @version 25. Januar 2022
*/ */
public class Turtle public class Turtle
{ {
...@@ -54,12 +53,18 @@ public class Turtle ...@@ -54,12 +53,18 @@ public class Turtle
private int _verzoegerung; private int _verzoegerung;
// Moegliche Farbwerte // Moegliche Farbwerte
private static final HashMap<String, Color> FARBEN; private static final LinkedHashMap<String, Color> FARBEN;
private static final Color[] FARB_ARRAY; private static final Color[] FARB_ARRAY;
static static
{ {
FARBEN = new HashMap<String, Color>(); FARBEN = new LinkedHashMap<String, Color>();
FARBEN.put("schwarz", Color.BLACK);
FARBEN.put("blau", Color.BLUE);
FARBEN.put("cyan", Color.CYAN);
FARBEN.put("dunkelgrau", Color.DARK_GRAY);
FARBEN.put("grau", Color.GRAY);
FARBEN.put("gruen", Color.GREEN);
FARBEN.put("hellgrau", Color.LIGHT_GRAY); FARBEN.put("hellgrau", Color.LIGHT_GRAY);
FARBEN.put("magenta", Color.MAGENTA); FARBEN.put("magenta", Color.MAGENTA);
FARBEN.put("pink", Color.PINK); FARBEN.put("pink", Color.PINK);
...@@ -300,8 +305,7 @@ class TurtleWelt ...@@ -300,8 +305,7 @@ class TurtleWelt
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
_graphics = image.createGraphics(); _graphics = image.createGraphics();
_graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, _graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
RenderingHints.VALUE_ANTIALIAS_ON);
_graphics.setColor(Color.WHITE); _graphics.setColor(Color.WHITE);
_graphics.fillRect(0, 0, WIDTH, HEIGHT); _graphics.fillRect(0, 0, WIDTH, HEIGHT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment