1: package ;
2:
3:
4: import ;
5: import ;
6: import ;
7: import ;
8:
9: import ;
10: import ;
11:
12:
20: public class ImageViewIconFactory
21: {
22: private static Icon noImageIcon;
23:
24: private static Icon loadingImageIcon;
25:
26:
31: public static class NoImageIcon implements Icon, Serializable
32: {
33:
36: public NoImageIcon()
37: {
38:
39: }
40:
41:
46: public int getIconWidth()
47: {
48: return 38;
49: }
50:
51:
56: public int getIconHeight()
57: {
58: return 38;
59: }
60:
61:
73: public void paintIcon(Component c, Graphics g, int x, int y)
74: {
75:
76: Color savedColor = g.getColor();
77:
78: g.setColor(MetalLookAndFeel.getBlack());
79:
80: g.drawLine(x, y, x + 19, y);
81:
82: g.drawLine(x, y + 1, x, y + 5);
83: g.drawLine(x, y + 13, x, y + 25);
84:
85: g.drawLine(x, y + 25, x + 22, y + 25);
86:
87: g.drawLine(x + 22, y + 25, x + 22, y + 21);
88: g.drawLine(x + 22, y + 13, x + 22, y + 6);
89:
90: g.drawLine(x + 22, y + 6, x + 19, y);
91:
92: g.drawLine(x + 17, y + 2, x + 21, y + 6);
93:
94: g.drawLine(x + 18, y + 1, x + 19, y + 1);
95:
96: g.setColor(MetalLookAndFeel.getControlShadow());
97:
98: g.drawLine(x + 1, y + 1, x + 17, y + 1);
99:
100: g.drawLine(x + 1, y + 1, x + 1, y + 5);
101: g.drawLine(x + 1, y + 13, x + 1, y + 24);
102:
103: g.drawLine(x + 1, y + 24, x + 21, y + 24);
104:
105: g.drawLine(x + 21, y + 24, x + 21, y + 21);
106: g.drawLine(x + 21, y + 13, x + 21, y + 7);
107:
108: g.drawLine(x + 18, y + 2, x + 20, y + 4);
109:
110:
111:
112:
113: g.drawLine(x + 1, y + 6, x + 20, y + 13);
114: g.drawLine(x + 1, y + 13, x + 20, y + 20);
115:
116:
117: g.setColor(MetalLookAndFeel.getBlack());
118: g.drawLine(x, y + 6, x + 21, y + 14);
119: g.drawLine(x, y + 12, x + 21, y + 20);
120:
121:
122:
123: y += 1;
124: x += 3;
125:
126: g.setColor(MetalLookAndFeel.getBlack());
127:
128:
129: g.drawLine(x + 4, y + 5, x + 8, y + 1);
130: g.drawLine(x + 8, y + 1, x + 15, y + 8);
131:
132:
133: g.drawLine(x + 11, y + 2, x + 11, y + 4);
134: g.drawLine(x + 12, y + 2, x + 12, y + 5);
135:
136: g.setColor(MetalLookAndFeel.getControlDarkShadow());
137:
138:
139: int xx = x + 8;
140: for (int i = 0; i < 4; i++)
141: g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
142: g.fillRect(x + 4, y + 6, 9, 2);
143:
144:
145: g.drawLine(x + 3, y + 14, x + 3, y + 18);
146: g.drawLine(x + 3, y + 18, x + 13, y + 18);
147:
148: g.setColor(savedColor);
149: }
150: }
151:
152:
156: public static class LoadingImageIcon implements Icon, Serializable
157: {
158:
159:
162: public LoadingImageIcon()
163: {
164:
165: }
166:
167:
172: public int getIconWidth()
173: {
174: return 38;
175: }
176:
177:
182: public int getIconHeight()
183: {
184: return 38;
185: }
186:
187:
199: public void paintIcon(Component c, Graphics g, int x, int y)
200: {
201:
202: Color savedColor = g.getColor();
203:
204: g.setColor(Color.black);
205: g.drawLine(x, y, x + 19, y);
206: g.drawLine(x, y + 1, x, y + 25);
207: g.drawLine(x, y + 25, x + 22, y + 25);
208: g.drawLine(x + 22, y + 25, x + 22, y + 6);
209: g.drawLine(x + 22, y + 6, x + 19, y);
210:
211: g.drawLine(x + 17, y + 2, x + 21, y + 6);
212: g.drawLine(x + 18, y + 1, x + 19, y + 1);
213:
214: g.setColor(new Color(204, 204, 255));
215:
216: g.drawLine(x + 1, y + 1, x + 17, y + 1);
217: g.drawLine(x + 1, y + 1, x + 1, y + 24);
218: g.drawLine(x + 1, y + 24, x + 21, y + 24);
219: g.drawLine(x + 21, y + 24, x + 21, y + 7);
220: g.drawLine(x + 18, y + 2, x + 20, y + 4);
221:
222:
223:
224: y += 3;
225: x += 3;
226:
227: g.setColor(MetalLookAndFeel.getBlack());
228:
229:
230: g.drawLine(x + 1, y + 8, x + 8, y + 1);
231: g.drawLine(x + 8, y + 1, x + 15, y + 8);
232:
233:
234: g.drawLine(x + 3, y + 6, x + 3, y + 15);
235: g.drawLine(x + 3, y + 15, x + 13, y + 15);
236: g.drawLine(x + 13, y + 6, x + 13, y + 15);
237:
238:
239: g.drawLine(x + 6, y + 9, x + 6, y + 15);
240: g.drawLine(x + 6, y + 9, x + 10, y + 9);
241: g.drawLine(x + 10, y + 9, x + 10, y + 15);
242:
243:
244: g.drawLine(x + 11, y + 2, x + 11, y + 4);
245: g.drawLine(x + 12, y + 2, x + 12, y + 5);
246:
247: g.setColor(MetalLookAndFeel.getControlDarkShadow());
248:
249:
250: int xx = x + 8;
251: for (int i = 0; i < 4; i++)
252: g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
253: g.fillRect(x + 4, y + 6, 9, 2);
254:
255:
256: g.drawLine(x + 9, y + 12, x + 9, y + 12);
257:
258:
259: g.setColor(MetalLookAndFeel.getPrimaryControl());
260: g.drawLine(x + 4, y + 8, x + 12, y + 8);
261: g.fillRect(x + 4, y + 9, 2, 6);
262: g.fillRect(x + 11, y + 9, 2, 6);
263:
264: g.setColor(savedColor);
265: }
266: }
267:
268: public static Icon getNoImageIcon()
269: {
270: if (noImageIcon == null)
271: noImageIcon = new NoImageIcon();
272: return noImageIcon;
273: }
274:
275: public static Icon getLoadingImageIcon()
276: {
277: if (loadingImageIcon == null)
278: loadingImageIcon = new LoadingImageIcon();
279: return loadingImageIcon;
280: }
281:
282: }