01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.bpel.design.model.elements.icons;
21:
22: import java.awt.Graphics2D;
23: import java.awt.Shape;
24: import java.awt.geom.GeneralPath;
25:
26: /**
27: *
28: * @author anjeleevich
29: */
30: public class XORSmallIcon2D extends Icon2D {
31:
32: private XORSmallIcon2D() {
33: }
34:
35: public void paint(Graphics2D g2) {
36: g2.setPaint(COLOR);
37: g2.fill(SHAPE);
38: }
39:
40: public static final Icon2D INSTANCE = new XORSmallIcon2D();
41:
42: private static final Shape SHAPE;
43:
44: static {
45: final float w = 24f / 4 - 1;
46: final float h = 24f / 4 - 1;
47:
48: final float s = 3.5f;
49:
50: final float x1 = -w;
51: final float x2 = -w + s;
52: final float x3 = w - s;
53: final float x4 = w;
54:
55: final float y1 = -h;
56: final float y2 = h;
57:
58: final float rx = s / 2;
59: final float ry = h * rx / (w - rx);
60:
61: GeneralPath gp = new GeneralPath();
62:
63: gp.moveTo(x1, y1);
64: gp.lineTo(x2, y1);
65: gp.lineTo(0, -ry);
66: gp.lineTo(x3, y1);
67: gp.lineTo(x4, y1);
68: gp.lineTo(rx, 0);
69: gp.lineTo(x4, y2);
70: gp.lineTo(x3, y2);
71: gp.lineTo(0, ry);
72: gp.lineTo(x2, y2);
73: gp.lineTo(x1, y2);
74: gp.lineTo(-rx, 0);
75: gp.closePath();
76:
77: SHAPE = gp;
78: }
79: }
|