1 /*********************************************************************
5 * Purpose : Painting details for rendering the beveled arrow icon.
7 * Copyright : Written by and Copyright (C) 2003 the SourceForge
8 * Privoxy team. http://www.privoxy.org/
10 * Based on the Internet Junkbuster originally written
11 * by and Copyright (C) 1997 Anonymous Coders and
12 * Junkbusters Corporation. http://www.junkbusters.com
14 * This program is free software; you can redistribute it
15 * and/or modify it under the terms of the GNU General
16 * Public License as published by the Free Software
17 * Foundation; either version 2 of the License, or (at
18 * your option) any later version.
20 * This program is distributed in the hope that it will
21 * be useful, but WITHOUT ANY WARRANTY; without even the
22 * implied warranty of MERCHANTABILITY or FITNESS FOR A
23 * PARTICULAR PURPOSE. See the GNU General Public
24 * License for more details.
26 * The GNU General Public License should be included with
27 * this file. If not, you can view it at
28 * http://www.gnu.org/copyleft/gpl.html
29 * or write to the Free Software Foundation, Inc., 59
30 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 *********************************************************************/
36 package org.privoxy.activityconsole;
42 * Painting details for rendering the beveled arrow icon.
43 * @author Last Modified By: $Author$
44 * @version $Rev$-$Date$$State$
46 public class BevelArrowIcon implements Icon
49 private static final String
50 COPYRIGHT = org.privoxy.activityconsole.Copyright.COPYRIGHT;
52 public static final int UP = 0; // direction
53 public static final int DOWN = 1;
55 private static final int DEFAULT_SIZE = 11;
61 private int direction;
63 public BevelArrowIcon(int direction, boolean isRaisedView, boolean isPressedView)
69 init( UIManager.getColor("controlLtHighlight"),
70 UIManager.getColor("controlDkShadow"),
71 UIManager.getColor("controlShadow"),
72 DEFAULT_SIZE, direction);
76 init( UIManager.getColor("controlHighlight"),
77 UIManager.getColor("controlShadow"),
78 UIManager.getColor("control"),
79 DEFAULT_SIZE, direction);
86 init( UIManager.getColor("controlDkShadow"),
87 UIManager.getColor("controlLtHighlight"),
88 UIManager.getColor("controlShadow"),
89 DEFAULT_SIZE, direction);
93 init( UIManager.getColor("controlShadow"),
94 UIManager.getColor("controlHighlight"),
95 UIManager.getColor("control"),
96 DEFAULT_SIZE, direction);
101 public BevelArrowIcon(Color edge1, Color edge2, Color fill,
102 int size, int direction)
104 init(edge1, edge2, fill, size, direction);
108 public void paintIcon(Component c, Graphics g, int x, int y)
112 case DOWN: drawDownArrow(g, x, y); break;
113 case UP: drawUpArrow(g, x, y); break;
117 public int getIconWidth()
122 public int getIconHeight()
128 private void init(Color edge1, Color edge2, Color fill,
129 int size, int direction)
135 this.direction = direction;
138 private void drawDownArrow(Graphics g, int xo, int yo)
141 g.drawLine(xo, yo, xo+size-1, yo);
142 g.drawLine(xo, yo+1, xo+size-3, yo+1);
144 g.drawLine(xo+size-2, yo+1, xo+size-1, yo+1);
148 while (y+1 < yo+size)
151 g.drawLine(x, y, x+1, y);
152 g.drawLine(x, y+1, x+1, y+1);
156 g.drawLine(x+2, y, x+1+dx, y);
157 g.drawLine(x+2, y+1, x+1+dx, y+1);
160 g.drawLine(x+dx+2, y, x+dx+3, y);
161 g.drawLine(x+dx+2, y+1, x+dx+3, y+1);
167 g.drawLine(xo+(size/2), yo+size-1, xo+(size/2), yo+size-1);
170 private void drawUpArrow(Graphics g, int xo, int yo)
174 g.drawLine(x, yo, x, yo);
178 while (y+3 < yo+size)
181 g.drawLine(x, y, x+1, y);
182 g.drawLine(x, y+1, x+1, y+1);
186 g.drawLine(x+2, y, x+1+dx, y);
187 g.drawLine(x+2, y+1, x+1+dx, y+1);
190 g.drawLine(x+dx+2, y, x+dx+3, y);
191 g.drawLine(x+dx+2, y+1, x+dx+3, y+1);
197 g.drawLine(xo, yo+size-3, xo+1, yo+size-3);
199 g.drawLine(xo+2, yo+size-2, xo+size-1, yo+size-2);
200 g.drawLine(xo, yo+size-1, xo+size, yo+size-1);