97 |
{ |
{ |
98 |
public Insets getBorderInsets(Component c) |
public Insets getBorderInsets(Component c) |
99 |
{ |
{ |
100 |
return new Insets(2, 2, 2, 2); |
return new Insets(2, 2, 2, 2); |
101 |
} |
} |
102 |
|
|
103 |
public boolean isBorderOpaque() |
public boolean isBorderOpaque() |
104 |
{ |
{ |
105 |
return true; |
return true; |
106 |
} |
} |
107 |
|
|
108 |
public void paintBorder(Component c, Graphics g, int x, int y, int w, |
public void paintBorder(Component c, Graphics g, int x, int y, int w, |
109 |
int h) |
int h) |
110 |
{ |
{ |
111 |
System.out.println("PAINTING BORDER"); |
Color saved = g.getColor(); |
112 |
Color saved = g.getColor(); |
g.setColor(highlight); |
|
g.setColor(highlight); |
|
113 |
|
|
114 |
g.drawLine(x + 1, y + 1, x + w - 1, y + 1); |
g.drawLine(x + 1, y + 1, x + w - 1, y + 1); |
115 |
g.drawLine(x + 1, y + 1, x + 1, y + h - 1); |
g.drawLine(x + 1, y + 1, x + 1, y + h - 1); |
116 |
|
|
117 |
g.setColor(shadow); |
g.setColor(shadow); |
118 |
|
|
119 |
g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); |
g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); |
120 |
g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); |
g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); |
121 |
|
|
122 |
g.setColor(darkShadow); |
g.setColor(darkShadow); |
123 |
|
|
124 |
g.drawLine(x, y + h, x + w, y + h); |
g.drawLine(x, y + h, x + w, y + h); |
125 |
g.drawLine(x + w, y, x + w, y + h); |
g.drawLine(x + w, y, x + w, y + h); |
126 |
|
|
127 |
g.setColor(saved); |
g.setColor(saved); |
128 |
} |
} |
129 |
}; |
}; |
130 |
|
|
260 |
switch (direction) |
switch (direction) |
261 |
{ |
{ |
262 |
case NORTH: |
case NORTH: |
263 |
arrow = upIcon; |
arrow = upIcon; |
264 |
break; |
break; |
265 |
case SOUTH: |
case SOUTH: |
266 |
arrow = downIcon; |
arrow = downIcon; |
267 |
break; |
break; |
268 |
case EAST: |
case EAST: |
269 |
case RIGHT: |
case RIGHT: |
270 |
arrow = rightIcon; |
arrow = rightIcon; |
271 |
break; |
break; |
272 |
case WEST: |
case WEST: |
273 |
case LEFT: |
case LEFT: |
274 |
arrow = leftIcon; |
arrow = leftIcon; |
275 |
break; |
break; |
276 |
} |
} |
277 |
|
|
285 |
|
|
286 |
if (size != defaultSize) |
if (size != defaultSize) |
287 |
{ |
{ |
288 |
float scale = size * 1f / defaultSize; |
float scale = size * 1f / defaultSize; |
289 |
for (int i = 0; i < 3; i++) |
for (int i = 0; i < 3; i++) |
290 |
{ |
{ |
291 |
xPoints[i] *= scale; |
xPoints[i] *= scale; |
292 |
yPoints[i] *= scale; |
yPoints[i] *= scale; |
293 |
} |
} |
294 |
} |
} |
295 |
g.translate(x, y); |
g.translate(x, y); |
296 |
|
|
297 |
switch (direction) |
switch (direction) |
298 |
{ |
{ |
299 |
case NORTH: |
case NORTH: |
300 |
x1 = xPoints[0] + 2; |
x1 = xPoints[0] + 2; |
301 |
y1 = yPoints[0]; |
y1 = yPoints[0]; |
302 |
y2 = y1; |
y2 = y1; |
303 |
x2 = xPoints[2] - 1; |
x2 = xPoints[2] - 1; |
304 |
break; |
break; |
305 |
case SOUTH: |
case SOUTH: |
306 |
x1 = xPoints[1]; |
x1 = xPoints[1]; |
307 |
y1 = yPoints[1] + 1; |
y1 = yPoints[1] + 1; |
308 |
x2 = xPoints[2] - 1; |
x2 = xPoints[2] - 1; |
309 |
y2 = yPoints[2]; |
y2 = yPoints[2]; |
310 |
break; |
break; |
311 |
case LEFT: |
case LEFT: |
312 |
case WEST: |
case WEST: |
313 |
x1 = xPoints[0] + 1; |
x1 = xPoints[0] + 1; |
314 |
y1 = yPoints[0] + 1; |
y1 = yPoints[0] + 1; |
315 |
x2 = x1; |
x2 = x1; |
316 |
y2 = yPoints[2] + 1; |
y2 = yPoints[2] + 1; |
317 |
break; |
break; |
318 |
case RIGHT: |
case RIGHT: |
319 |
case EAST: |
case EAST: |
320 |
x1 = xPoints[2]; |
x1 = xPoints[2]; |
321 |
y1 = yPoints[2] + 1; |
y1 = yPoints[2] + 1; |
322 |
x2 = xPoints[1] - 1; |
x2 = xPoints[1] - 1; |
323 |
y2 = yPoints[1] + 1; |
y2 = yPoints[1] + 1; |
324 |
break; |
break; |
325 |
} |
} |
326 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
327 |
|
|
328 |
if (isEnabled) |
if (isEnabled) |
329 |
{ |
{ |
330 |
g.setColor(Color.DARK_GRAY); |
g.setColor(Color.DARK_GRAY); |
331 |
|
|
332 |
if (arrow != null) |
if (arrow != null) |
333 |
g.fillPolygon(xPoints, yPoints, 3); |
g.fillPolygon(xPoints, yPoints, 3); |
334 |
} |
} |
335 |
else |
else |
336 |
{ |
{ |
337 |
g.setColor(Color.GRAY); |
g.setColor(Color.GRAY); |
338 |
g.fillPolygon(xPoints, yPoints, 3); |
g.fillPolygon(xPoints, yPoints, 3); |
339 |
g.setColor(Color.WHITE); |
g.setColor(Color.WHITE); |
340 |
g.drawLine(x1, y1, x2, y2); |
g.drawLine(x1, y1, x2, y2); |
341 |
} |
} |
342 |
g.setColor(saved); |
g.setColor(saved); |
343 |
g.translate(-x, -y); |
g.translate(-x, -y); |