01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.core.gui.base;
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.ImageIcon;
24:
25: @SuppressWarnings({"serial","serial"})
26: public class AscendingIcon extends ImageIcon {
27:
28: private Color color = new Color(100, 100, 100);
29:
30: public AscendingIcon() {
31: super ();
32: }
33:
34: public AscendingIcon(Color color) {
35: super ();
36: this .color = color;
37: }
38:
39: public void paintIcon(Component c, Graphics g, int x, int y) {
40: Graphics2D g2 = (Graphics2D) g;
41:
42: int[] xp = new int[3];
43: int[] yp = new int[3];
44:
45: xp[0] = x;
46: xp[1] = x + 9;
47: xp[2] = x + 4;
48:
49: yp[0] = y;
50: yp[1] = y;
51: yp[2] = y + 5;
52:
53: g2.setColor(color);
54: g2.fillPolygon(xp, yp, 3);
55: }
56:
57: /**
58: * @see javax.swing.Icon#getIconHeight()
59: */
60: public int getIconHeight() {
61: return 6;
62: }
63:
64: /**
65: * @see javax.swing.Icon#getIconWidth()
66: */
67: public int getIconWidth() {
68: return 10;
69: }
70:
71: }
|