GraphicsApp API
Eine überarbeitete und angepasste Variante der originalen GraphicsApp-Umgebung
Colors.java
gehe zur Dokumentation dieser Datei
1package de.ur.mi.oop.colors;
2
3import java.util.Random;
4
5/**
6 * Eine Sammlung von vordefinierten GraphicsApp-Colors.
7 */
8public class Colors {
9
10 private static final Random rand = new Random();
11
12 public static final Color RED = new Color(255, 0, 0);
13 public static final Color ORANGE = new Color(255, 153, 0);
14 public static final Color YELLOW = new Color(255, 255, 0);
15 public static final Color GREEN = new Color(51, 204, 51);
16 public static final Color BLUE = new Color(0, 102, 255);
17 public static final Color PURPLE = new Color(204, 51, 255);
18 public static final Color PINK = new Color(255, 102, 153);
19 public static final Color BROWN = new Color(204, 102, 0);
20 public static final Color WHITE = new Color(255, 255, 255);
21 public static final Color BLACK = new Color(0, 0, 0);
22 public static final Color GREY = new Color(100, 100, 100);
23 public static final Color TRANSPARENT = new Color(255, 255, 255, 0);
24
25 /**
26 * Erzeugt eine zufällige, opake Farbe.
27 *
28 * @return Ein Color-Objekt, das mit zufälligen Rot-, Grün- und Blauwerten instantiiert wurde.
29 */
30 public static final Color getRandomColor() {
31 int red = (rand.nextInt(256) + 255) / 2;
32 int green = (rand.nextInt(256) + 255) / 2;
33 int blue = (rand.nextInt(256) + 255) / 2;
34 return new Color(red, green, blue);
35 }
36}
static final Color RED
Definition: Colors.java:12
static final Color YELLOW
Definition: Colors.java:14
static final Color TRANSPARENT
Definition: Colors.java:23
static final Color GREY
Definition: Colors.java:22
static final Color getRandomColor()
Definition: Colors.java:30
static final Color PINK
Definition: Colors.java:18
static final Color GREEN
Definition: Colors.java:15
static final Color BROWN
Definition: Colors.java:19
static final Color BLUE
Definition: Colors.java:16
static final Color PURPLE
Definition: Colors.java:17
static final Color BLACK
Definition: Colors.java:21
static final Color WHITE
Definition: Colors.java:20
static final Color ORANGE
Definition: Colors.java:13