01: /*
02: * BlankIcon.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.table;
23:
24: import java.awt.Color;
25: import java.awt.Component;
26: import java.awt.Graphics;
27:
28: import javax.swing.Icon;
29:
30: /* ----------------------------------------------------------
31: * CVS NOTE: Changes to the CVS repository prior to the
32: * release of version 3.0.0beta1 has meant a
33: * resetting of CVS revision numbers.
34: * ----------------------------------------------------------
35: */
36:
37: /**
38: *
39: * @author Takis Diakoumis
40: * @version $Revision: 1.4 $
41: * @date $Date: 2006/05/14 06:56:07 $
42: */
43: public class BlankIcon implements Icon {
44:
45: private Color fillColor;
46: private int size;
47:
48: public BlankIcon() {
49: this (null, 11);
50: }
51:
52: public BlankIcon(Color color, int size) {
53: fillColor = color;
54: this .size = size;
55: }
56:
57: public void paintIcon(Component c, Graphics g, int x, int y) {
58: if (fillColor != null) {
59: g.setColor(fillColor);
60: g.drawRect(x, y, size - 1, size - 1);
61: }
62: }
63:
64: public int getIconWidth() {
65: return size;
66: }
67:
68: public int getIconHeight() {
69: return size;
70: }
71: }
|