01: /*
02: * Copyright (C) Jakub Neubauer, 2007
03: *
04: * This file is part of TaskBlocks
05: *
06: * TaskBlocks is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 3 of the License, or
09: * (at your option) any later version.
10: *
11: * TaskBlocks 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, see <http://www.gnu.org/licenses/>.
18: */
19:
20: package taskblocks.modelimpl;
21:
22: import java.awt.Color;
23: import java.awt.Graphics2D;
24: import java.awt.image.BufferedImage;
25:
26: import javax.swing.Icon;
27: import javax.swing.ImageIcon;
28:
29: import taskblocks.Colors;
30:
31: public class ColorLabel {
32:
33: public static ColorLabel[] COLOR_LABELS = new ColorLabel[] {
34: new ColorLabel("None", Colors.TASK_COLOR, 0),
35: new ColorLabel("Red", new Color(255, 120, 100), 1),
36: new ColorLabel("Orange", new Color(255, 200, 80), 2),
37: new ColorLabel("Yellow", new Color(255, 255, 100), 3),
38: new ColorLabel("Green", new Color(140, 255, 110), 4),
39: new ColorLabel("Gray", new Color(200, 200, 200), 5), };
40:
41: public Color _color;
42: public String _name;
43: public Icon _icon;
44: public int _index;
45:
46: public ColorLabel(String name, Color color, int index) {
47: _name = name;
48: _color = color;
49: _index = index;
50: BufferedImage img = new BufferedImage(12, 12,
51: BufferedImage.TYPE_INT_ARGB);
52: Graphics2D g2 = (Graphics2D) img.getGraphics();
53: g2.setColor(_color);
54: g2.fillRect(0, 0, img.getWidth(), img.getHeight());
55: _icon = new ImageIcon(img);
56: }
57:
58: public String toString() {
59: return _name;
60: }
61: }
|