-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathIcons.java
More file actions
145 lines (120 loc) · 3.84 KB
/
Icons.java
File metadata and controls
145 lines (120 loc) · 3.84 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package nodebox;
import javax.swing.*;
import java.awt.*;
/**
* Icons used in NodeBox.
*/
public class Icons {
public static class MultiArrowIcon extends ArrowIcon {
public MultiArrowIcon(int direction, Color color) {
super(direction, color);
}
public void paintIcon(Component component, Graphics g, int x, int y) {
g.setColor(color);
g.translate(x, y);
if (direction == NORTH) {
} else if (direction == SOUTH) {
g.drawLine(0, 1, 14, 1);
g.drawLine(1, 2, 13, 2);
g.drawLine(2, 3, 4, 3);
g.drawLine(6, 3, 8, 3);
g.drawLine(10, 3, 12, 3);
g.drawLine(3, 4, 3, 4);
g.drawLine(7, 4, 7, 4);
g.drawLine(11, 4, 11, 4);
}
g.translate(-x, -y);
}
public int getIconWidth() {
return 15;
}
}
public static abstract class ColoredIcon implements Icon {
protected Color color;
protected ColoredIcon() {
color = Color.black;
}
protected ColoredIcon(Color color) {
this.color = color;
}
public int getIconWidth() {
return 7;
}
public int getIconHeight() {
return 7;
}
}
public static class PlusIcon extends ColoredIcon {
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(color);
g.translate(x, y);
g.drawLine(0, 3, 5, 3);
g.drawLine(0, 4, 5, 4);
g.drawLine(2, 1, 2, 6);
g.drawLine(3, 1, 3, 6);
}
}
public static class MinusIcon extends ColoredIcon {
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(color);
g.translate(x, y);
g.drawLine(0, 3, 5, 3);
g.drawLine(0, 4, 5, 4);
}
}
public static class ArrowIcon implements Icon {
public static final int NORTH = 0;
public static final int EAST = 1;
public static final int SOUTH = 2;
public static final int WEST = 3;
protected int direction;
protected Color color;
public ArrowIcon(int direction) {
this(direction, Color.black);
}
public ArrowIcon(int direction, Color color) {
this.direction = direction;
this.color = color;
}
public void paintIcon(Component component, Graphics g, int x, int y) {
g.setColor(color);
g.translate(x, y);
if (direction == NORTH) {
g.drawLine(3, 1, 3, 1);
g.drawLine(2, 2, 4, 2);
g.drawLine(1, 3, 5, 3);
g.drawLine(0, 4, 6, 4);
} else if (direction == EAST) {
g.drawLine(1, 0, 1, 6);
g.drawLine(2, 1, 2, 5);
g.drawLine(3, 2, 3, 4);
g.drawLine(4, 3, 4, 3);
} else if (direction == SOUTH) {
g.drawLine(0, 1, 6, 1);
g.drawLine(1, 2, 5, 2);
g.drawLine(2, 3, 4, 3);
g.drawLine(3, 4, 3, 4);
} else if (direction == WEST) {
g.drawLine(4, 0, 4, 6);
g.drawLine(3, 1, 3, 5);
g.drawLine(2, 2, 2, 4);
g.drawLine(1, 3, 1, 3);
}
g.translate(-x, -y);
//
// g.setColor(color);
// g.translate(x,y);
// g.drawLine(0,0,6,0);
// g.drawLine(1,1, 5, 1);
// g.drawLine(2,2, 4, 2);
// g.drawLine(3,3, 3, 3);
// g.translate(-x, -y);
}
public int getIconWidth() {
return 7;
}
public int getIconHeight() {
return 7;
}
}
}