KickJava   Java API By Example, From Geeks To Geeks.

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


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  * A textbox is a shape that may hold a rich text string.
21  *
22  * @author Glen Stampoultzis (glens at apache.org)
23  */

24 public class HSSFTextbox
25         extends HSSFSimpleShape
26 {
27     public final static short OBJECT_TYPE_TEXT = 6;
28
29     int marginLeft, marginRight, marginTop, marginBottom;
30
31     HSSFRichTextString string = new HSSFRichTextString("");
32
33     /**
34      * Construct a new textbox with the given parent and anchor.
35      * @param parent
36      * @param anchor One of HSSFClientAnchor or HSSFChildAnchor
37      */

38     public HSSFTextbox( HSSFShape parent, HSSFAnchor anchor )
39     {
40         super( parent, anchor );
41         setShapeType(OBJECT_TYPE_TEXT);
42     }
43
44     /**
45      * @return the rich text string for this textbox.
46      */

47     public HSSFRichTextString getString()
48     {
49         return string;
50     }
51
52     /**
53      * @param string Sets the rich text string used by this object.
54      */

55     public void setString( HSSFRichTextString string )
56     {
57         this.string = string;
58     }
59
60     /**
61      * @return Returns the left margin within the textbox.
62      */

63     public int getMarginLeft()
64     {
65         return marginLeft;
66     }
67
68     /**
69      * Sets the left margin within the textbox.
70      */

71     public void setMarginLeft( int marginLeft )
72     {
73         this.marginLeft = marginLeft;
74     }
75
76     /**
77      * @return returns the right margin within the textbox.
78      */

79     public int getMarginRight()
80     {
81         return marginRight;
82     }
83
84     /**
85      * Sets the right margin within the textbox.
86      */

87     public void setMarginRight( int marginRight )
88     {
89         this.marginRight = marginRight;
90     }
91
92     /**
93      * @return returns the top margin within the textbox.
94      */

95     public int getMarginTop()
96     {
97         return marginTop;
98     }
99
100     /**
101      * Sets the top margin within the textbox.
102      */

103     public void setMarginTop( int marginTop )
104     {
105         this.marginTop = marginTop;
106     }
107
108     /**
109      * Gets the bottom margin within the textbox.
110      */

111     public int getMarginBottom()
112     {
113         return marginBottom;
114     }
115
116     /**
117      * Sets the bottom margin within the textbox.
118      */

119     public void setMarginBottom( int marginBottom )
120     {
121         this.marginBottom = marginBottom;
122     }
123 }
124
Popular Tags