-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIUtils.java
More file actions
55 lines (39 loc) · 1.5 KB
/
UIUtils.java
File metadata and controls
55 lines (39 loc) · 1.5 KB
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
45
46
47
48
49
50
51
52
53
54
55
import java.util.*;
import javafx.scene.*;
import javafx.scene.layout.*;
public class UIUtils {
public static final String GLOBAL = "*G*";
public static int architecture = 64; // number of bits
private static List<String> colorWheel;
private static int colorWheelIndex = 0;
public static final int SD_EV_MEMORYLOCKED = 0;
public static final int SD_EV_VALUESET = 1;
public static final int SD_EV_VALUECLEARED = 2;
public static final int SD_EV_MEMORYUNLOCKED = 3;
public static Node getByUserData(Pane parent, Object data) {
for (Node n : parent.getChildren()) {
if (data.equals(n.getUserData())) return n;
}
return null ;
}
public static void initializeColorWheel() {
colorWheel = new ArrayList<>();
colorWheel.add("#ff0000"); // red
colorWheel.add("#ffa500"); // orange
colorWheel.add("#ffff00"); // yellow
colorWheel.add("#00ff00"); // green
colorWheel.add("#00ffff"); // teal
colorWheel.add("#ff69b4"); // pink
colorWheel.add("#ff00ff"); // magenta
}
public static void resetColorIndex() { colorWheelIndex = 0; }
public static String getNextColor() {
String color = colorWheel.get(colorWheelIndex);
++colorWheelIndex;
if (colorWheelIndex >= colorWheel.size()) colorWheelIndex = 0;
return color;
}
public static double calculateFontSize(double fontSize, double windowWidth, double windowHeight) {
return ((windowWidth + windowHeight) / 70) * fontSize;
}
}