KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > Rectangle


1 /*
2  * $Id: Rectangle.java 2752 2007-05-15 14:58:33Z blowagie $
3  * $Name$
4  *
5  * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
6  *
7  * The contents of this file are subject to the Mozilla Public License Version 1.1
8  * (the "License"); you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the License.
14  *
15  * The Original Code is 'iText, a free JAVA-PDF library'.
16  *
17  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
18  * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
19  * All Rights Reserved.
20  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
21  * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
22  *
23  * Contributor(s): all the names of the contributors are added in the source code
24  * where applicable.
25  *
26  * Alternatively, the contents of this file may be used under the terms of the
27  * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
28  * provisions of LGPL are applicable instead of those above. If you wish to
29  * allow use of your version of this file only under the terms of the LGPL
30  * License and not to allow others to use your version of this file under
31  * the MPL, indicate your decision by deleting the provisions above and
32  * replace them with the notice and other provisions required by the LGPL.
33  * If you do not delete the provisions above, a recipient may use your version
34  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Library General Public License as published by the Free Software Foundation;
39  * either version 2 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
43  * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
44  * details.
45  *
46  * If you didn't download this code from the following link, you should check if
47  * you aren't using an obsolete version:
48  * http://www.lowagie.com/iText/
49  */

50
51 package com.lowagie.text;
52
53 import java.awt.Color JavaDoc;
54 import java.util.ArrayList JavaDoc;
55
56 import com.lowagie.text.pdf.GrayColor;
57
58 /**
59  * A <CODE>Rectangle</CODE> is the representation of a geometric figure.
60  *
61  * Rectangles support constant width borders using
62  * {@link #setBorderWidth(float)}and {@link #setBorder(int)}. They also
63  * support borders that vary in width/color on each side using methods like
64  * {@link #setBorderWidthLeft(float)}or
65  * {@link #setBorderColorLeft(java.awt.Color)}.
66  *
67  * @see Element
68  * @see Table
69  * @see Cell
70  * @see HeaderFooter
71  */

72
73 public class Rectangle implements Element {
74
75     // static final membervariables (concerning the presence of borders)
76

77     /** This is the value that will be used as <VAR>undefined </VAR>. */
78     public static final int UNDEFINED = -1;
79
80     /** This represents one side of the border of the <CODE>Rectangle</CODE>. */
81     public static final int TOP = 1;
82
83     /** This represents one side of the border of the <CODE>Rectangle</CODE>. */
84     public static final int BOTTOM = 2;
85
86     /** This represents one side of the border of the <CODE>Rectangle</CODE>. */
87     public static final int LEFT = 4;
88
89     /** This represents one side of the border of the <CODE>Rectangle</CODE>. */
90     public static final int RIGHT = 8;
91
92     /** This represents a rectangle without borders. */
93     public static final int NO_BORDER = 0;
94
95     /** This represents a type of border. */
96     public static final int BOX = TOP + BOTTOM + LEFT + RIGHT;
97
98     // membervariables
99

100     /** the lower left x-coordinate. */
101     protected float llx;
102
103     /** the lower left y-coordinate. */
104     protected float lly;
105
106     /** the upper right x-coordinate. */
107     protected float urx;
108
109     /** the upper right y-coordinate. */
110     protected float ury;
111
112     /** The rotation of the Rectangle */
113     protected int rotation = 0;
114
115     /** This represents the status of the 4 sides of the rectangle. */
116     protected int border = UNDEFINED;
117
118     /** This is the width of the border around this rectangle. */
119     protected float borderWidth = UNDEFINED;
120
121     /** The color of the border of this rectangle. */
122     protected Color JavaDoc borderColor = null;
123
124     /** This is the color of the background of this rectangle. */
125     protected Color JavaDoc backgroundColor = null;
126
127     /** Whether variable width/color borders are used. */
128     protected boolean useVariableBorders = false;
129
130     /** The width of the left border of this rectangle. */
131     protected float borderWidthLeft = UNDEFINED;
132
133     /** The width of the right border of this rectangle. */
134     protected float borderWidthRight = UNDEFINED;
135
136     /** The width of the top border of this rectangle. */
137     protected float borderWidthTop = UNDEFINED;
138
139     /** The width of the bottom border of this rectangle. */
140     protected float borderWidthBottom = UNDEFINED;
141
142     /** The color of the left border of this rectangle. */
143     protected Color JavaDoc borderColorLeft = null;
144
145     /** The color of the right border of this rectangle. */
146     protected Color JavaDoc borderColorRight = null;
147
148     /** The color of the top border of this rectangle. */
149     protected Color JavaDoc borderColorTop = null;
150
151     /** The color of the bottom border of this rectangle. */
152     protected Color JavaDoc borderColorBottom = null;
153
154     // constructors
155

156     /**
157      * Constructs a <CODE>Rectangle</CODE> -object.
158      *
159      * @param llx
160      * lower left x
161      * @param lly
162      * lower left y
163      * @param urx
164      * upper right x
165      * @param ury
166      * upper right y
167      */

168     public Rectangle(float llx, float lly, float urx, float ury) {
169         this.llx = llx;
170         this.lly = lly;
171         this.urx = urx;
172         this.ury = ury;
173     }
174
175     /**
176      * Constructs a <CODE>Rectangle</CODE> -object starting from the origin
177      * (0, 0).
178      *
179      * @param urx
180      * upper right x
181      * @param ury
182      * upper right y
183      */

184     public Rectangle(float urx, float ury) {
185         this(0, 0, urx, ury);
186     }
187
188     /**
189      * Constructs a <CODE>Rectangle</CODE> -object.
190      *
191      * @param rect
192      * another <CODE>Rectangle</CODE>
193      */

194     public Rectangle(Rectangle rect) {
195         this(rect.llx, rect.lly, rect.urx, rect.ury);
196         cloneNonPositionParameters(rect);
197     }
198
199     // implementation of the Element interface
200

201     /**
202      * Processes the element by adding it (or the different parts) to an <CODE>
203      * ElementListener</CODE>.
204      *
205      * @param listener
206      * an <CODE>ElementListener</CODE>
207      * @return <CODE>true</CODE> if the element was processed successfully
208      */

209     public boolean process(ElementListener listener) {
210         try {
211             return listener.add(this);
212         } catch (DocumentException de) {
213             return false;
214         }
215     }
216
217     /**
218      * Gets the type of the text element.
219      *
220      * @return a type
221      */

222     public int type() {
223         return Element.RECTANGLE;
224     }
225
226     /**
227      * Gets all the chunks in this element.
228      *
229      * @return an <CODE>ArrayList</CODE>
230      */

231     public ArrayList JavaDoc getChunks() {
232         return new ArrayList JavaDoc();
233     }
234
235     // methods to get/set the dimensions
236

237     /**
238      * Sets the lower left x-coordinate.
239      *
240      * @param value
241      * the new value
242      */

243     public void setLeft(float value) {
244         llx = value;
245     }
246
247     /**
248      * Returns the lower left x-coordinate.
249      *
250      * @return the lower left x-coordinate
251      */

252     public float getLeft() {
253         return llx;
254     }
255
256     /**
257      * Returns the lower left x-coordinate, considering a given margin.
258      *
259      * @param margin
260      * a margin
261      * @return the lower left x-coordinate
262      */

263     public float getLeft(float margin) {
264         return llx + margin;
265     }
266
267     /**
268      * Sets the upper right x-coordinate.
269      *
270      * @param value
271      * the new value
272      */

273
274     public void setRight(float value) {
275         urx = value;
276     }
277
278     /**
279      * Returns the upper right x-coordinate.
280      *
281      * @return the upper right x-coordinate
282      */

283     public float getRight() {
284         return urx;
285     }
286
287     /**
288      * Returns the upper right x-coordinate, considering a given margin.
289      *
290      * @param margin
291      * a margin
292      * @return the upper right x-coordinate
293      */

294     public float getRight(float margin) {
295         return urx - margin;
296     }
297
298     /**
299      * Returns the width of the rectangle.
300      *
301      * @return a width
302      */

303     public float getWidth() {
304         return urx - llx;
305     }
306
307     /**
308      * Sets the upper right y-coordinate.
309      *
310      * @param value
311      * the new value
312      */

313     public void setTop(float value) {
314         ury = value;
315     }
316
317     /**
318      * Returns the upper right y-coordinate.
319      *
320      * @return the upper right y-coordinate
321      */

322     public float getTop() {
323         return ury;
324     }
325
326     /**
327      * Returns the upper right y-coordinate, considering a given margin.
328      *
329      * @param margin
330      * a margin
331      * @return the upper right y-coordinate
332      */

333     public float getTop(float margin) {
334         return ury - margin;
335     }
336
337     /**
338      * Sets the lower left y-coordinate.
339      *
340      * @param value
341      * the new value
342      */

343     public void setBottom(float value) {
344         lly = value;
345     }
346
347     /**
348      * Returns the lower left y-coordinate.
349      *
350      * @return the lower left y-coordinate
351      */

352     public float getBottom() {
353         return lly;
354     }
355
356     /**
357      * Returns the lower left y-coordinate, considering a given margin.
358      *
359      * @param margin
360      * a margin
361      * @return the lower left y-coordinate
362      */

363     public float getBottom(float margin) {
364         return lly + margin;
365     }
366
367     /**
368      * Returns the height of the rectangle.
369      *
370      * @return a height
371      */

372     public float getHeight() {
373         return ury - lly;
374     }
375
376     /**
377      * Switches lowerleft with upperright
378      */

379     public void normalize() {
380         if (llx > urx) {
381             float a = llx;
382             llx = urx;
383             urx = a;
384         }
385         if (lly > ury) {
386             float a = lly;
387             lly = ury;
388             ury = a;
389         }
390     }
391
392     // methods to get/set the rotation
393

394     /**
395      * Gets the rotation of the rectangle
396      *
397      * @return a rotation value
398      */

399     public int getRotation() {
400         return rotation;
401     }
402
403     /**
404      * Swaps the values of urx and ury and of lly and llx in order to rotate the
405      * rectangle.
406      *
407      * @return a <CODE>Rectangle</CODE>
408      */

409     public Rectangle rotate() {
410         Rectangle rect = new Rectangle(lly, llx, ury, urx);
411         rect.rotation = rotation + 90;
412         rect.rotation %= 360;
413         return rect;
414     }
415     
416     // border
417

418     /**
419      * Returns the exact type of the border.
420      *
421      * @return a value
422      */

423     public int getBorder() {
424         return border;
425     }
426
427     /**
428      * Indicates if the table has borders.
429      *
430      * @return a boolean
431      */

432     public boolean hasBorders() {
433         return (border > 0)
434                 && ((borderWidth > 0) || (borderWidthLeft > 0)
435                         || (borderWidthRight > 0) || (borderWidthTop > 0) || (borderWidthBottom > 0));
436     }
437
438     /**
439      * Indicates if the table has a some type of border.
440      *
441      * @param type
442      * the type of border
443      * @return a boolean
444      */

445     public boolean hasBorder(int type) {
446         return border != UNDEFINED && (border & type) == type;
447     }
448     
449     /**
450      * Enables/Disables the border on the specified sides. The border is
451      * specified as an integer bitwise combination of the constants: <CODE>
452      * LEFT, RIGHT, TOP, BOTTOM</CODE>.
453      *
454      * @see #enableBorderSide(int)
455      * @see #disableBorderSide(int)
456      * @param value
457      * the new value
458      */

459     public void setBorder(int value) {
460         border = value;
461     }
462
463     /**
464      * Enables the border on the specified side.
465      *
466      * @param side
467      * the side to enable. One of <CODE>LEFT, RIGHT, TOP, BOTTOM
468      * </CODE>
469      */

470     public void enableBorderSide(int side) {
471         if (border == UNDEFINED) {
472             border = 0;
473         }
474         border |= side;
475     }
476
477     /**
478      * Disables the border on the specified side.
479      *
480      * @param side
481      * the side to disable. One of <CODE>LEFT, RIGHT, TOP, BOTTOM
482      * </CODE>
483      */

484     public void disableBorderSide(int side) {
485         if (border == UNDEFINED) {
486             border = 0;
487         }
488         border &= ~side;
489     }
490
491     // borderwidth
492

493     /**
494      * Gets the borderwidth.
495      *
496      * @return a value
497      */

498     public float getBorderWidth() {
499         return borderWidth;
500     }
501     
502     /**
503      * Sets the borderwidth of the table.
504      *
505      * @param value
506      * the new value
507      */

508
509     public void setBorderWidth(float value) {
510         borderWidth = value;
511     }
512
513     // bordercolor
514

515     /**
516      * Gets the color of the border.
517      *
518      * @return a value
519      */

520
521     public Color JavaDoc getBorderColor() {
522         return borderColor;
523     }
524     
525     /**
526      * Sets the color of the border.
527      *
528      * @param value
529      * the new value
530      */

531
532     public void setBorderColor(Color JavaDoc value) {
533         borderColor = value;
534     }
535
536     // backgroundcolor
537

538     /**
539      * Gets the backgroundcolor.
540      *
541      * @return a value
542      */

543     public Color JavaDoc getBackgroundColor() {
544         return backgroundColor;
545     }
546     
547     /**
548      * Sets the backgroundcolor of the rectangle.
549      *
550      * @param value
551      * the new value
552      */

553
554     public void setBackgroundColor(Color JavaDoc value) {
555         backgroundColor = value;
556     }
557
558     /**
559      * Gets the grayscale.
560      *
561      * @return a value
562      */

563
564     public float getGrayFill() {
565         if (backgroundColor instanceof GrayColor)
566             return ((GrayColor)backgroundColor).getGray();
567         else
568             return 0;
569     }
570
571     /**
572      * Sets the grayscale of the rectangle.
573      *
574      * @param value
575      * the new value
576      */

577     public void setGrayFill(float value) {
578         backgroundColor = new GrayColor(value);
579     }
580
581     // variable borders
582

583     /**
584      * Indicates whether variable width borders are being used. Returns true if
585      * <CODE>setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, or
586      * setBorderWidthBottom</CODE> has been called.
587      *
588      * @return true if variable width borders are in use
589      *
590      */

591     public boolean isUseVariableBorders() {
592         return useVariableBorders;
593     }
594
595     /**
596      * Sets a parameter indicating if the rectangle has variable borders
597      *
598      * @param useVariableBorders
599      * indication if the rectangle has variable borders
600      */

601     public void setUseVariableBorders(boolean useVariableBorders) {
602         this.useVariableBorders = useVariableBorders;
603     }
604     
605     // variable border width
606

607     /** Gives the border width of a specific side. */
608     private float getVariableBorderWidth(float variableWidthValue, int side) {
609         if ((border & side) != 0) {
610             return variableWidthValue != UNDEFINED ? variableWidthValue
611                     : borderWidth;
612         } else {
613             return 0;
614         }
615     }
616
617     /**
618      * Updates the border flag for a side based on the specified width. A width
619      * of 0 will disable the border on that side. Any other width enables it.
620      *
621      * @param width
622      * width of border
623      * @param side
624      * border side constant
625      */

626     private void updateBorderBasedOnWidth(float width, int side) {
627         useVariableBorders = true;
628         if (width > 0) {
629             enableBorderSide(side);
630         } else {
631             disableBorderSide(side);
632         }
633     }
634
635     /**
636      * Gets the width of a border.
637      *
638      * @return a width
639      */

640     public float getBorderWidthLeft() {
641         return getVariableBorderWidth(borderWidthLeft, LEFT);
642     }
643
644     /**
645      * Sets the width of a border
646      *
647      * @param borderWidthLeft
648      * a width
649      */

650     public void setBorderWidthLeft(float borderWidthLeft) {
651         this.borderWidthLeft = borderWidthLeft;
652         updateBorderBasedOnWidth(borderWidthLeft, LEFT);
653     }
654
655     /**
656      * Gets the width of a border.
657      *
658      * @return a width
659      */

660     public float getBorderWidthRight() {
661         return getVariableBorderWidth(borderWidthRight, RIGHT);
662     }
663
664     /**
665      * Sets the width of a border
666      *
667      * @param borderWidthRight
668      * a width
669      */

670     public void setBorderWidthRight(float borderWidthRight) {
671         this.borderWidthRight = borderWidthRight;
672         updateBorderBasedOnWidth(borderWidthRight, RIGHT);
673     }
674
675     /**
676      * Gets the width of a border.
677      *
678      * @return a width
679      */

680     public float getBorderWidthTop() {
681         return getVariableBorderWidth(borderWidthTop, TOP);
682     }
683
684     /**
685      * Sets the width of a border
686      *
687      * @param borderWidthTop
688      * a width
689      */

690     public void setBorderWidthTop(float borderWidthTop) {
691         this.borderWidthTop = borderWidthTop;
692         updateBorderBasedOnWidth(borderWidthTop, TOP);
693     }
694
695     /**
696      * Gets the width of a border.
697      *
698      * @return a width
699      */

700     public float getBorderWidthBottom() {
701         return getVariableBorderWidth(borderWidthBottom, BOTTOM);
702     }
703
704     /**
705      * Sets the width of a border
706      *
707      * @param borderWidthBottom
708      * a width
709      */

710     public void setBorderWidthBottom(float borderWidthBottom) {
711         this.borderWidthBottom = borderWidthBottom;
712         updateBorderBasedOnWidth(borderWidthBottom, BOTTOM);
713     }
714
715     // variable border color
716

717     /**
718      * Gets the color of a border.
719      *
720      * @return a color value
721      */

722     public Color JavaDoc getBorderColorLeft() {
723         if (borderColorLeft == null) return borderColor;
724         return borderColorLeft;
725     }
726
727     /**
728      * Sets the value of the border color
729      *
730      * @param value
731      * a color value
732      */

733     public void setBorderColorLeft(Color JavaDoc value) {
734         borderColorLeft = value;
735     }
736
737     /**
738      * Gets the color of a border.
739      *
740      * @return a color value
741      */

742     public Color JavaDoc getBorderColorRight() {
743         if (borderColorRight == null) return borderColor;
744         return borderColorRight;
745     }
746
747     /**
748      * Sets the value of the border color
749      *
750      * @param value
751      * a color value
752      */

753     public void setBorderColorRight(Color JavaDoc value) {
754         borderColorRight = value;
755     }
756
757     /**
758      * Gets the color of a border.
759      *
760      * @return a color value
761      */

762     public Color JavaDoc getBorderColorTop() {
763         if (borderColorTop == null) return borderColor;
764         return borderColorTop;
765     }
766
767     /**
768      * Sets the value of the border color
769      *
770      * @param value
771      * a color value
772      */

773     public void setBorderColorTop(Color JavaDoc value) {
774         borderColorTop = value;
775     }
776
777     /**
778      * Gets the color of a border.
779      *
780      * @return a color value
781      */

782     public Color JavaDoc getBorderColorBottom() {
783         if (borderColorBottom == null) return borderColor;
784         return borderColorBottom;
785     }
786
787     /**
788      * Sets the value of the border color
789      *
790      * @param value
791      * a color value
792      */

793     public void setBorderColorBottom(Color JavaDoc value) {
794         borderColorBottom = value;
795     }
796
797     // special methods
798

799     /**
800      * Gets a Rectangle that is altered to fit on the page.
801      *
802      * @param top
803      * the top position
804      * @param bottom
805      * the bottom position
806      * @return a <CODE>Rectangle</CODE>
807      */

808     public Rectangle rectangle(float top, float bottom) {
809         Rectangle tmp = new Rectangle(this);
810         if (getTop() > top) {
811             tmp.setTop(top);
812             tmp.disableBorderSide(TOP);
813         }
814         if (getBottom() < bottom) {
815             tmp.setBottom(bottom);
816             tmp.disableBorderSide(BOTTOM);
817         }
818         return tmp;
819     }
820
821     /**
822      * Copies all of the parameters from a <CODE>Rectangle</CODE> object
823      * except the position.
824      *
825      * @param rect
826      * <CODE>Rectangle</CODE> to copy from
827      */

828     public void cloneNonPositionParameters(Rectangle rect) {
829         this.rotation = rect.rotation;
830         this.border = rect.border;
831         this.borderWidth = rect.borderWidth;
832         this.borderColor = rect.borderColor;
833         this.backgroundColor = rect.backgroundColor;
834         this.useVariableBorders = rect.useVariableBorders;
835         this.borderWidthLeft = rect.borderWidthLeft;
836         this.borderWidthRight = rect.borderWidthRight;
837         this.borderWidthTop = rect.borderWidthTop;
838         this.borderWidthBottom = rect.borderWidthBottom;
839         this.borderColorLeft = rect.borderColorLeft;
840         this.borderColorRight = rect.borderColorRight;
841         this.borderColorTop = rect.borderColorTop;
842         this.borderColorBottom = rect.borderColorBottom;
843     }
844
845     /**
846      * Copies all of the parameters from a <CODE>Rectangle</CODE> object
847      * except the position.
848      *
849      * @param rect
850      * <CODE>Rectangle</CODE> to copy from
851      */

852     public void softCloneNonPositionParameters(Rectangle rect) {
853         if (rect.rotation != 0)
854             this.rotation = rect.rotation;
855         if (rect.border != UNDEFINED)
856             this.border = rect.border;
857         if (rect.borderWidth != UNDEFINED)
858             this.borderWidth = rect.borderWidth;
859         if (rect.borderColor != null)
860             this.borderColor = rect.borderColor;
861         if (rect.backgroundColor != null)
862             this.backgroundColor = rect.backgroundColor;
863         if (useVariableBorders)
864             this.useVariableBorders = rect.useVariableBorders;
865         if (rect.borderWidthLeft != UNDEFINED)
866             this.borderWidthLeft = rect.borderWidthLeft;
867         if (rect.borderWidthRight != UNDEFINED)
868             this.borderWidthRight = rect.borderWidthRight;
869         if (rect.borderWidthTop != UNDEFINED)
870             this.borderWidthTop = rect.borderWidthTop;
871         if (rect.borderWidthBottom != UNDEFINED)
872             this.borderWidthBottom = rect.borderWidthBottom;
873         if (rect.borderColorLeft != null)
874             this.borderColorLeft = rect.borderColorLeft;
875         if (rect.borderColorRight != null)
876             this.borderColorRight = rect.borderColorRight;
877         if (rect.borderColorTop != null)
878             this.borderColorTop = rect.borderColorTop;
879         if (rect.borderColorBottom != null)
880             this.borderColorBottom = rect.borderColorBottom;
881     }
882     
883     /**
884      * @see java.lang.Object#toString()
885      */

886     public String JavaDoc toString() {
887         StringBuffer JavaDoc buf = new StringBuffer JavaDoc("Rectangle: ");
888         buf.append(getWidth());
889         buf.append('x');
890         buf.append(getHeight());
891         buf.append(" (rot: ");
892         buf.append(rotation);
893         buf.append(" degrees)");
894         return buf.toString();
895     }
896
897 // deprecated stuff
898

899     /**
900      * Returns the lower left x-coordinate.
901      *
902      * @return the lower left x-coordinate
903      * @deprecated Use {@link #getLeft()} instead
904      */

905     public float left() {
906         return getLeft();
907     }
908
909     /**
910      * Returns the upper right x-coordinate.
911      *
912      * @return the upper right x-coordinate
913      * @deprecated Use {@link #getRight()} instead
914      */

915     public float right() {
916         return getRight();
917     }
918
919     /**
920      * Returns the upper right y-coordinate.
921      *
922      * @return the upper right y-coordinate
923      * @deprecated Use {@link #getTop()} instead
924      */

925     public float top() {
926         return getTop();
927     }
928
929     /**
930      * Returns the lower left y-coordinate.
931      *
932      * @return the lower left y-coordinate
933      * @deprecated Use {@link #getBottom()} instead
934      */

935     public float bottom() {
936         return getBottom();
937     }
938
939     /**
940      * Returns the lower left x-coordinate, considering a given margin.
941      *
942      * @param margin
943      * a margin
944      * @return the lower left x-coordinate
945      * @deprecated Use {@link #getLeft(float)} instead
946      */

947     public float left(float margin) {
948         return getLeft(margin);
949     }
950
951     /**
952      * Returns the upper right x-coordinate, considering a given margin.
953      *
954      * @param margin
955      * a margin
956      * @return the upper right x-coordinate
957      * @deprecated Use {@link #getRight(float)} instead
958      */

959     public float right(float margin) {
960         return getRight(margin);
961     }
962
963     /**
964      * Returns the width of the rectangle.
965      *
966      * @return a width
967      * @deprecated Use {@link #getWidth()} instead
968      */

969     public float width() {
970         return getWidth();
971     }
972
973     /**
974      * Returns the upper right y-coordinate, considering a given margin.
975      *
976      * @param margin
977      * a margin
978      * @return the upper right y-coordinate
979      * @deprecated Use {@link #getTop(float)} instead
980      */

981     public float top(float margin) {
982         return getTop(margin);
983     }
984
985     /**
986      * Returns the lower left y-coordinate, considering a given margin.
987      *
988      * @param margin
989      * a margin
990      * @return the lower left y-coordinate
991      * @deprecated Use {@link #getBottom(float)} instead
992      */

993     public float bottom(float margin) {
994         return getBottom(margin);
995     }
996
997     /**
998      * Returns the height of the rectangle.
999      *
1000     * @return a height
1001     * @deprecated Use {@link #getHeight()} instead
1002     */

1003    public float height() {
1004        return getHeight();
1005    }
1006
1007    /**
1008     * Returns the exact type of the border.
1009     *
1010     * @return a value
1011     * @deprecated Use {@link #getBorder()} instead
1012     */

1013    public int border() {
1014        return getBorder();
1015    }
1016
1017    /**
1018     * Gets the borderwidth.
1019     *
1020     * @return a value
1021     * @deprecated Use {@link #getBorderWidth()} instead
1022     */

1023    public float borderWidth() {
1024        return getBorderWidth();
1025    }
1026
1027    /**
1028     * Gets the color of the border.
1029     *
1030     * @return a value
1031     * @deprecated Use {@link #getBorderColor()} instead
1032     */

1033    
1034    public Color JavaDoc borderColor() {
1035        return getBorderColor();
1036    }
1037
1038    /**
1039     * Gets the backgroundcolor.
1040     *
1041     * @return a value
1042     * @deprecated Use {@link #getBackgroundColor()} instead
1043     */

1044    public Color JavaDoc backgroundColor() {
1045        return getBackgroundColor();
1046    }
1047
1048    /**
1049     * Gets the grayscale.
1050     *
1051     * @return a value
1052     * @deprecated Use {@link #getGrayFill()} instead
1053     */

1054    
1055    public float grayFill() {
1056        return getGrayFill();
1057    }
1058    
1059}
Popular Tags