1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.richclient.test;
17
18 import java.awt.Color;
19 import java.awt.Component;
20 import java.awt.Graphics;
21 import java.awt.Graphics2D;
22
23 import javax.swing.Icon;
24
25
26
27
28
29
30 public class TestIcon implements Icon{
31
32 private Color color;
33
34 public TestIcon(Color color) {
35 this.color = color;
36 }
37
38 public int getIconHeight() {
39 return 16;
40 }
41
42 public int getIconWidth() {
43 return 16;
44 }
45
46 public void paintIcon(Component c, Graphics g, int x, int y) {
47 Graphics2D graphics = (Graphics2D) g.create();
48
49 graphics.setColor(color);
50 graphics.fillRect(x, y, 16, 16);
51
52 graphics.dispose();
53 }
54
55 }