-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorObject.java
More file actions
executable file
·44 lines (35 loc) · 862 Bytes
/
Copy pathColorObject.java
File metadata and controls
executable file
·44 lines (35 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.awt.*;
public class ColorObject {
private Color c;
private boolean use;
private String name;
public ColorObject(Color cI, boolean useI, String nameI) {
c = cI;
use = useI;
name = nameI;
}
public Color getColor() {
return c;
}
public boolean getUse() {
return use;
}
public String getName() {
return name;
}
public static Color[] selectColors(ColorObject[] origColorObjects) {
Color[] selectColors = new Color[origColorObjects.length];
int counter1 = 0;
for (int i = 0; i < origColorObjects.length; i++) {
if (origColorObjects[i].getUse()) {
selectColors[counter1] = origColorObjects[i].getColor();
counter1++;
}
}
Color[] selectColorsShortened = new Color[counter1];
for (int i = 0; i < counter1; i++) {
selectColorsShortened[i] = selectColors[i];
}
return selectColorsShortened;
}
}