KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtriver > open > vectorvisuals > meta > connector > ArrowTipFactory


1 /*
2  * ArrowTipFactory.java
3  *
4  * Created on 20 June 2003, 14:29
5  */

6
7 package com.thoughtriver.open.vectorvisuals.meta.connector;
8
9 import java.awt.*;
10
11 /**
12  * This class provides static methods that return various arrow tip <CODE>Shape</CODE>s.
13  * These are suitable for use as the ends of <CODE>VisualConnectorObject</CODE>s.
14  *
15  * @author Brandon Franklin
16  * @version $Date: 2006/11/25 08:58:56 $
17  */

18 final public class ArrowTipFactory {
19
20     /**
21      * Made private to prevent use.
22      */

23     private ArrowTipFactory() {
24     }
25
26     /**
27      * Vends a basic triangular arrow tip that is suitable for use as an
28      * endpoint <CODE>Shape</CODE>.
29      *
30      * @return a basic triangular arrow tip <CODE>Shape</CODE>
31      */

32     static public Shape getBasicArrowTip() {
33         Polygon arrowTip = new Polygon();
34         arrowTip.addPoint(-4, -8);
35         arrowTip.addPoint(0, 0);
36         arrowTip.addPoint(4, -8);
37         arrowTip.addPoint(0, 0);
38
39         return arrowTip;
40     }
41
42     /**
43      * Vends a triangular arrow tip with sharp angles that is suitable for use
44      * as an endpoint <CODE>Shape</CODE>.
45      *
46      * @return a triangular arrow tip <CODE>Shape</CODE> with sharp angles
47      */

48     static public Shape getAngularArrowTip() {
49         Polygon arrowTip = new Polygon();
50         arrowTip.addPoint(-4, -8);
51         arrowTip.addPoint(0, -4);
52         arrowTip.addPoint(4, -8);
53         arrowTip.addPoint(0, 0);
54
55         return arrowTip;
56     }
57
58     /**
59      * Vends a triangular arrow tip with a closed bottom that is suitable for
60      * use as an endpoint <CODE>Shape</CODE>.
61      *
62      * @return a triangular arrow tip <CODE>Shape</CODE> with a closed bottom
63      */

64     static public Shape getClosedArrowTip() {
65         Polygon arrowTip = new Polygon();
66         arrowTip.addPoint(-5, -8);
67         arrowTip.addPoint(0, 0);
68         arrowTip.addPoint(5, -8);
69
70         return arrowTip;
71     }
72 }
73
Popular Tags