01: /*
02: * TabCloseIcon.java
03: *
04: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: */
21:
22: package org.underworldlabs.swing.plaf;
23:
24: import java.awt.Component;
25: import java.awt.Graphics;
26: import javax.swing.Icon;
27: import javax.swing.UIManager;
28:
29: /* ----------------------------------------------------------
30: * CVS NOTE: Changes to the CVS repository prior to the
31: * release of version 3.0.0beta1 has meant a
32: * resetting of CVS revision numbers.
33: * ----------------------------------------------------------
34: */
35:
36: /**
37: * Simple icon drawing the close button
38: * for a closeable tab on the CloseTabbedPane.
39: *
40: * @author Takis Diakoumis
41: * @version $Revision: 1.4 $
42: * @date $Date: 2006/05/14 06:56:07 $
43: */
44: public class TabCloseIcon implements Icon {
45:
46: /** the icon width */
47: protected static final int ICON_WIDTH = 6;
48:
49: /** the icon height */
50: protected static final int ICON_HEIGHT = 6;
51:
52: /** Creates a new instance of TabCloseButtonIcon */
53: public TabCloseIcon() {
54: }
55:
56: /**
57: * Returns the icon's height.
58: *
59: * @return the height of the icon
60: */
61: public int getIconHeight() {
62: return ICON_HEIGHT;
63: }
64:
65: /**
66: * Returns the icon's width.
67: *
68: * @return the width of the icon
69: */
70: public int getIconWidth() {
71: return ICON_WIDTH;
72: }
73:
74: /**
75: * Draw the icon at the specified location.
76: *
77: * @param the component
78: * @param the graphics context
79: * @param x coordinate
80: * @param y coordinate
81: */
82: public void paintIcon(Component c, Graphics g, int x, int y) {
83: g.setColor(UIManager.getColor("controlShadow").darker()
84: .darker());
85: g.drawLine(x, y, x + ICON_WIDTH - 1, y + ICON_HEIGHT - 1);
86: g.drawLine(x + ICON_WIDTH - 1, y, x, y + ICON_HEIGHT - 1);
87: }
88:
89: }
|