01: // The UMLet source code is distributed under the terms of the GPL; see license.txt
02: package com.umlet.control;
03:
04: import java.awt.Color;
05: import java.awt.Component;
06: import java.awt.Graphics;
07:
08: import javax.swing.Icon;
09:
10: public class PlainColorIcon implements Icon {
11:
12: private Color color;
13:
14: public PlainColorIcon(Color color) {
15: this .color = color;
16: }
17:
18: public void paintIcon(Component c, Graphics g, int x, int y) {
19: Color old_color = g.getColor();
20: g.setColor(color);
21: g.fillRect(x, y, 10, 10);
22: g.setColor(old_color);
23: }
24:
25: public int getIconWidth() {
26: return 10;
27: }
28:
29: public int getIconHeight() {
30: return 10;
31: }
32:
33: }
|