KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > usermodel > HSSFPolygon


1 /* ====================================================================
2    Copyright 2004 Apache Software Foundation
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 ==================================================================== */

16
17 package org.apache.poi.hssf.usermodel;
18
19 /**
20  * @author Glen Stampoultzis (glens at superlinksoftware.com)
21  */

22 public class HSSFPolygon
23         extends HSSFShape
24 {
25     int[] xPoints;
26     int[] yPoints;
27     int drawAreaWidth = 100;
28     int drawAreaHeight = 100;
29
30     HSSFPolygon( HSSFShape parent, HSSFAnchor anchor )
31     {
32         super( parent, anchor );
33     }
34
35     public int[] getXPoints()
36     {
37         return xPoints;
38     }
39
40     public int[] getYPoints()
41     {
42         return yPoints;
43     }
44
45     public void setPoints(int[] xPoints, int[] yPoints)
46     {
47         this.xPoints = cloneArray(xPoints);
48         this.yPoints = cloneArray(yPoints);
49     }
50
51     private int[] cloneArray( int[] a )
52     {
53         int[] result = new int[a.length];
54         for ( int i = 0; i < a.length; i++ )
55             result[i] = a[i];
56
57         return result;
58     }
59
60     /**
61      * Defines the width and height of the points in the polygon
62      * @param width
63      * @param height
64      */

65     public void setPolygonDrawArea( int width, int height )
66     {
67         this.drawAreaWidth = width;
68         this.drawAreaHeight = height;
69     }
70
71     public int getDrawAreaWidth()
72     {
73         return drawAreaWidth;
74     }
75
76     public int getDrawAreaHeight()
77     {
78         return drawAreaHeight;
79     }
80
81
82 }
83
Popular Tags