com.pdfjet
Class Line

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

public class Line
extends java.lang.Object
implements Drawable

Used to create line objects. Please see Example_01.


Constructor Summary
Line()
          The default constructor.
Line(double x1, double y1, double x2, double y2)
          Create a line object.
Line(float x1, float y1, float x2, float y2)
          Create a line object.
 
Method Summary
 float[] drawOn(Page page)
          Draws this line on the specified page.
 int getCapStyle()
          Returns the line cap style.
 Point getEndPoint()
          Returns the end point of this line.
 Point getStartPoint()
          Returns the start point of this line.
 Line placeIn(Box box)
          Places this line in the specified box at position (0.0f, 0.0f).
 Line placeIn(Box box, double x_offset, double y_offset)
          Places this line in the specified box.
 Line placeIn(Box box, float x_offset, float y_offset)
          Places this line in the specified box.
 Line scaleBy(double factor)
          Scales this line by the spacified factor.
 Line scaleBy(float factor)
          Scales this line by the spacified factor.
 Line setActualText(java.lang.String actualText)
          Sets the actual text for this line.
 Line setAltDescription(java.lang.String altDescription)
          Sets the alternate description of this line.
 Line setCapStyle(int style)
          Sets the line cap style.
 Line setColor(int color)
          Sets the color for this line.
 Line setEndPoint(double x, double y)
          Sets the x and y coordinates of the end point.
 Line setEndPoint(float x, float y)
          Sets the x and y coordinates of the end point.
 Line setPattern(java.lang.String pattern)
          The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
 Line setPointA(float x, float y)
          Sets the x and y coordinates of the start point.
 Line setPointB(float x, float y)
          Sets the x and y coordinates of the end point.
 Line setStartPoint(double x, double y)
          Sets the x and y coordinates of the start point.
 Line setStartPoint(float x, float y)
          Sets the x and y coordinates of the start point.
 Line setWidth(double width)
          Sets the width of this line.
 Line setWidth(float width)
          Sets the width of this line.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Line

public Line()
The default constructor.


Line

public Line(double x1,
            double y1,
            double x2,
            double y2)
Create a line object.

Parameters:
x1 - the x coordinate of the start point.
y1 - the y coordinate of the start point.
x2 - the x coordinate of the end point.
y2 - the y coordinate of the end point.

Line

public Line(float x1,
            float y1,
            float x2,
            float y2)
Create a line object.

Parameters:
x1 - the x coordinate of the start point.
y1 - the y coordinate of the start point.
x2 - the x coordinate of the end point.
y2 - the y coordinate of the end point.
Method Detail

setPattern

public Line 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.
Returns:
this Line object.

setStartPoint

public Line setStartPoint(double x,
                          double y)
Sets the x and y coordinates of the start point.

Parameters:
x - the x coordinate of the start point.
y - the y coordinate of the start point.
Returns:
this Line object.

setStartPoint

public Line setStartPoint(float x,
                          float y)
Sets the x and y coordinates of the start point.

Parameters:
x - the x coordinate of the start point.
y - the y coordinate of the start point.
Returns:
this Line object.

setPointA

public Line setPointA(float x,
                      float y)
Sets the x and y coordinates of the start point.

Parameters:
x - the x coordinate of the start point.
y - the y coordinate of the start point.
Returns:
this Line object.

getStartPoint

public Point getStartPoint()
Returns the start point of this line.

Returns:
Point the point.

setEndPoint

public Line setEndPoint(double x,
                        double y)
Sets the x and y coordinates of the end point.

Parameters:
x - the x coordinate of the end point.
y - the y coordinate of the end point.
Returns:
this Line object.

setEndPoint

public Line setEndPoint(float x,
                        float y)
Sets the x and y coordinates of the end point.

Parameters:
x - the x coordinate of the end point.
y - the t coordinate of the end point.
Returns:
this Line object.

setPointB

public Line setPointB(float x,
                      float y)
Sets the x and y coordinates of the end point.

Parameters:
x - the x coordinate of the end point.
y - the t coordinate of the end point.
Returns:
this Line object.

getEndPoint

public Point getEndPoint()
Returns the end point of this line.

Returns:
Point the point.

setWidth

public Line setWidth(double width)
Sets the width of this line.

Parameters:
width - the width.
Returns:
this Line object.

setWidth

public Line setWidth(float width)
Sets the width of this line.

Parameters:
width - the width.
Returns:
this Line object.

setColor

public Line setColor(int color)
Sets the color for this line.

Parameters:
color - the color specified as an integer.
Returns:
this Line object.

setCapStyle

public Line setCapStyle(int style)
Sets the line cap style.

Parameters:
style - the cap style of the current line. Supported values: Cap.BUTT, Cap.ROUND and Cap.PROJECTING_SQUARE
Returns:
this Line object.

getCapStyle

public int getCapStyle()
Returns the line cap style.

Returns:
the cap style.

setAltDescription

public Line setAltDescription(java.lang.String altDescription)
Sets the alternate description of this line.

Parameters:
altDescription - the alternate description of the line.
Returns:
this Line.

setActualText

public Line setActualText(java.lang.String actualText)
Sets the actual text for this line.

Parameters:
actualText - the actual text for the line.
Returns:
this Line.

placeIn

public Line placeIn(Box box)
             throws java.lang.Exception
Places this line in the specified box at position (0.0f, 0.0f).

Parameters:
box - the specified box.
Returns:
this Line object.
Throws:
java.lang.Exception

placeIn

public Line placeIn(Box box,
                    double x_offset,
                    double y_offset)
             throws java.lang.Exception
Places this line in the specified box.

Parameters:
box - the specified 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.
Returns:
this Line object.
Throws:
java.lang.Exception

placeIn

public Line placeIn(Box box,
                    float x_offset,
                    float y_offset)
             throws java.lang.Exception
Places this line in the specified box.

Parameters:
box - the specified 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.
Returns:
this Line object.
Throws:
java.lang.Exception

scaleBy

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

Parameters:
factor - the factor used to scale the line.
Returns:
this Line object.
Throws:
java.lang.Exception

scaleBy

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

Parameters:
factor - the factor used to scale the line.
Returns:
this Line object.
Throws:
java.lang.Exception

drawOn

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

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