01: package net.xoetrope.builder.editor.helper;
02:
03: import java.awt.Component;
04: import java.awt.Graphics;
05: import java.awt.Point;
06: import javax.swing.Icon;
07:
08: /**
09: * Draw a close button for use on tabs
10: * <p>Copyright (c) Xoetrope 2002-2003, All rights reserved </p>
11: * <p>$Revision: 1.1 $ </p>
12: * <p>License: see license.txt </p>
13: */
14: public class XCloseIcon implements Icon {
15: Point location;
16:
17: public XCloseIcon() {
18: location = new Point();
19: }
20:
21: /**
22: * Returns the icon's height.
23: */
24: public int getIconHeight() {
25: return 10;
26: }
27:
28: /**
29: * Returns the icon's width.
30: * @return
31: */
32: public int getIconWidth() {
33: return 10;
34: }
35:
36: /**
37: * Paint the icon
38: * @param c
39: * @param g
40: * @param x
41: * @param y
42: */
43: public void paintIcon(Component c, Graphics g, int x, int y) {
44: g.setColor(c.getBackground().brighter());
45: g.fill3DRect(x, y, 12, 12, true);
46: g.setColor(c.getForeground());
47: g.drawLine(x + 4, y + 4, x + 8, y + 8);
48: g.drawLine(x + 8, y + 4, x + 4, y + 8);
49: location.x = x;
50: location.y = y;
51: }
52:
53: public Point getLocation() {
54: return location;
55: }
56: }
|