com.pdfjet
Class Box

java.lang.Object
  extended by com.pdfjet.Box
All Implemented Interfaces:
Drawable

public class Box
extends java.lang.Object
implements Drawable

Used to create rectangular boxes on a page. Also used to for layout purposes. See the placeIn method in the Image and TextLine classes.


Constructor Summary
Box()
          The default constructor.
Box(double x, double y, double w, double h)
          Creates a box object.
Box(float x, float y, float w, float h)
          Creates a box object.
 
Method Summary
 float[] drawOn(Page page)
          Draws this box on the specified page.
 void placeIn(Box box, double x_offset, double y_offset)
          Places this box in the another box.
 void placeIn(Box box, float x_offset, float y_offset)
          Places this box in the another box.
 void scaleBy(double factor)
          Scales this box by the spacified factor.
 void scaleBy(float factor)
          Scales this box by the spacified factor.
 Box setActualText(java.lang.String actualText)
          Sets the actual text for this box.
 Box setAltDescription(java.lang.String altDescription)
          Sets the alternate description of this box.
 void setColor(int color)
          Sets the color for this box.
 void setFillShape(boolean fill_shape)
          Sets the private fill_shape variable.
 void setGoToAction(java.lang.String key)
          Sets the destination key for the action.
 void setLineWidth(double width)
          Sets the width of this line.
 void setLineWidth(float width)
          Sets the width of this line.
 Box setLocation(float x, float y)
          Sets the location of this box on the page.
 void setPattern(java.lang.String pattern)
          The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
 Box setPosition(double x, double y)
          Sets the position of this box on the page.
 Box setPosition(float x, float y)
          Sets the position of this box on the page.
 void setSize(double w, double h)
          Sets the size of this box.
 void setSize(float w, float h)
          Sets the size of this box.
 void setURIAction(java.lang.String uri)
          Sets the URI for the "click box" action.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Box

public Box()
The default constructor.


Box

public Box(double x,
           double y,
           double w,
           double h)
Creates a box object.

Parameters:
x - the x coordinate of the top left corner of this box when drawn on the page.
y - the y coordinate of the top left corner of this box when drawn on the page.
w - the width of this box.
h - the height of this box.

Box

public Box(float x,
           float y,
           float w,
           float h)
Creates a box object.

Parameters:
x - the x coordinate of the top left corner of this box when drawn on the page.
y - the y coordinate of the top left corner of this box when drawn on the page.
w - the width of this box.
h - the height of this box.
Method Detail

setPosition

public Box setPosition(double x,
                       double y)
Sets the position of this box on the page.

Parameters:
x - the x coordinate of the top left corner of this box when drawn on the page.
y - the y coordinate of the top left corner of this box when drawn on the page.

setPosition

public Box setPosition(float x,
                       float y)
Sets the position of this box on the page.

Parameters:
x - the x coordinate of the top left corner of this box when drawn on the page.
y - the y coordinate of the top left corner of this box when drawn on the page.

setLocation

public Box setLocation(float x,
                       float y)
Sets the location of this box on the page.

Parameters:
x - the x coordinate of the top left corner of this box when drawn on the page.
y - the y coordinate of the top left corner of this box when drawn on the page.

setSize

public void setSize(double w,
                    double h)
Sets the size of this box.

Parameters:
w - the width of this box.
h - the height of this box.

setSize

public void setSize(float w,
                    float h)
Sets the size of this box.

Parameters:
w - the width of this box.
h - the height of this box.

setColor

public void setColor(int color)
Sets the color for this box.

Parameters:
color - the color specified as an integer.

setLineWidth

public void setLineWidth(double width)
Sets the width of this line.

Parameters:
width - the width.

setLineWidth

public void setLineWidth(float width)
Sets the width of this line.

Parameters:
width - the width.

setURIAction

public void setURIAction(java.lang.String uri)
Sets the URI for the "click box" action.

Parameters:
uri - the URI

setGoToAction

public void setGoToAction(java.lang.String key)
Sets the destination key for the action.

Parameters:
key - the destination name.

setAltDescription

public Box setAltDescription(java.lang.String altDescription)
Sets the alternate description of this box.

Parameters:
altDescription - the alternate description of the box.
Returns:
this Box.

setActualText

public Box setActualText(java.lang.String actualText)
Sets the actual text for this box.

Parameters:
actualText - the actual text for the box.
Returns:
this Box.

setPattern

public void setPattern(java.lang.String pattern)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of the dash array are positive numbers that specify the lengths of alternating dashes and gaps. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units.
  Examples of line dash patterns:

      "[Array] Phase"     Appearance          Description
      _______________     _________________   ____________________________________

      "[] 0"              -----------------   Solid line
      "[3] 0"             ---   ---   ---     3 units on, 3 units off, ...
      "[2] 1"             -  --  --  --  --   1 on, 2 off, 2 on, 2 off, ...
      "[2 1] 0"           -- -- -- -- -- --   2 on, 1 off, 2 on, 1 off, ...
      "[3 5] 6"             ---     ---       2 off, 3 on, 5 off, 3 on, 5 off, ...
      "[2 3] 11"          -   --   --   --    1 on, 3 off, 2 on, 3 off, 2 on, ...
  

Parameters:
pattern - the line dash pattern.

setFillShape

public void setFillShape(boolean fill_shape)
Sets the private fill_shape variable. If the value of fill_shape is true - the box is filled with the current brush color.

Parameters:
fill_shape - the value used to set the private fill_shape variable.

placeIn

public void placeIn(Box box,
                    double x_offset,
                    double y_offset)
             throws java.lang.Exception
Places this box in the another box.

Parameters:
box - the other box.
x_offset - the x offset from the top left corner of the box.
y_offset - the y offset from the top left corner of the box.
Throws:
java.lang.Exception

placeIn

public void placeIn(Box box,
                    float x_offset,
                    float y_offset)
             throws java.lang.Exception
Places this box in the another box.

Parameters:
box - the other box.
x_offset - the x offset from the top left corner of the box.
y_offset - the y offset from the top left corner of the box.
Throws:
java.lang.Exception

scaleBy

public void scaleBy(double factor)
             throws java.lang.Exception
Scales this box by the spacified factor.

Parameters:
factor - the factor used to scale the box.
Throws:
java.lang.Exception

scaleBy

public void scaleBy(float factor)
             throws java.lang.Exception
Scales this box by the spacified factor.

Parameters:
factor - the factor used to scale the box.
Throws:
java.lang.Exception

drawOn

public float[] drawOn(Page page)
               throws java.lang.Exception
Draws this box on the specified page.

Specified by:
drawOn in interface Drawable
Parameters:
page - the page to draw this box on.
Returns:
x and y coordinates of the bottom right corner of this component.
Throws:
java.lang.Exception