java.lang.Objectcom.pdfjet.TextBox
public class TextBox
A box containing line-wrapped text.
Defaults:
x = 0f
y = 0f
width = 300f
height = 0f
alignment = Align.LEFT
valign = Align.TOP
spacing = 3f
margin = 1f
| Constructor Summary | |
|---|---|
TextBox(Font font)
Creates a text box and sets the font. |
|
TextBox(Font font,
java.lang.String text)
Creates a text box and sets the font. |
|
TextBox(Font font,
java.lang.String text,
double width,
double height)
Creates a text box and sets the font and the text. |
|
TextBox(Font font,
java.lang.String text,
float width,
float height)
Creates a text box and sets the font and the text. |
|
| Method Summary | |
|---|---|
float[] |
drawOn(Page page)
Draws this text box on the specified page. |
float[] |
drawOn(Page page,
boolean draw)
Draws this text box on the specified page. |
int |
getBgColor()
Returns the background color. |
boolean |
getBorder(int border)
Returns the text box border. |
int |
getBrushColor()
Returns the brush color. |
Font |
getFont()
Returns the font used by this text box. |
float |
getHeight()
Returns the text box height. |
float |
getLineWidth()
Returns the border line width. |
float |
getMargin()
Returns the text box margin. |
int |
getPenColor()
Returns the pen color as 0xRRGGBB integer. |
float |
getSpacing()
Returns the spacing between lines of text. |
boolean |
getStrikeout()
Returns the strikeout flag. |
java.lang.String |
getText()
Returns the text box text. |
int |
getTextAlignment()
Returns the text alignment. |
boolean |
getUnderline()
Whether the text will be underlined. |
int |
getVerticalAlignment()
|
float |
getWidth()
Returns the text box width. |
float |
getX()
Gets the x coordinate where this text box will be drawn on the page. |
float |
getY()
Gets the y coordinate where this text box will be drawn on the page. |
void |
setBgColor(double[] color)
Sets the background to the specified color. |
void |
setBgColor(int color)
Sets the background to the specified color. |
void |
setBgColor(int[] color)
Sets the background to the specified color. |
void |
setBorder(int border,
boolean visible)
Sets the TextBox border object. |
void |
setBrushColor(double[] color)
Sets the brush color. |
void |
setBrushColor(int color)
Sets the brush color. |
void |
setBrushColor(int[] color)
Sets the brush color. |
void |
setFallbackFont(Font font)
|
void |
setFgColor(double[] color)
Sets the foreground pen and brush colors to the specified color. |
void |
setFgColor(int color)
Sets the pen and brush colors to the specified color. |
void |
setFgColor(int[] color)
Sets the pen and brush colors to the specified color. |
void |
setFont(Font font)
Sets the font for this text box. |
void |
setHeight(double height)
Sets the height of this text box. |
void |
setHeight(float height)
Sets the height of this text box. |
void |
setLineWidth(double lineWidth)
Sets the border line width. |
void |
setLineWidth(float lineWidth)
Sets the border line width. |
void |
setLocation(float x,
float y)
Sets the location where this text box will be drawn on the page. |
void |
setMargin(double margin)
Sets the margin of this text box. |
void |
setMargin(float margin)
Sets the margin of this text box. |
void |
setNoBorders()
Sets all borders to be invisible. |
void |
setPenColor(double[] color)
Sets the pen color. |
void |
setPenColor(int color)
Sets the pen color. |
void |
setPenColor(int[] color)
Sets the pen color. |
void |
setPosition(double x,
double y)
Sets the position where this text box will be drawn on the page. |
void |
setPosition(float x,
float y)
Sets the position where this text box will be drawn on the page. |
void |
setSpacing(double spacing)
Sets the spacing between lines of text. |
void |
setSpacing(float spacing)
Sets the spacing between lines of text. |
void |
setStrikeout(boolean strikeout)
Sets the srikeout flag. |
void |
setText(java.lang.String text)
Sets the text box text. |
void |
setTextAlignment(int alignment)
Sets the cell text alignment. |
void |
setTextColors(java.util.Map<java.lang.String,java.lang.Integer> colors)
|
void |
setUnderline(boolean underline)
Sets the underline variable. |
void |
setVerticalAlignment(int alignment)
Sets the vertical alignment of the text in this TextBox. |
void |
setWidth(double width)
Sets the width of this text box. |
void |
setWidth(float width)
Sets the width of this text box. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextBox(Font font)
font - the font.
public TextBox(Font font,
java.lang.String text)
text - the text.font - the font.
public TextBox(Font font,
java.lang.String text,
double width,
double height)
font - the font.text - the text.width - the width.height - the height.
public TextBox(Font font,
java.lang.String text,
float width,
float height)
font - the font.text - the text.width - the width.height - the height.| Method Detail |
|---|
public void setFont(Font font)
font - the font.public Font getFont()
public void setText(java.lang.String text)
text - the text box text.public java.lang.String getText()
public void setPosition(double x,
double y)
x - the x coordinate of the top left corner of the text box.y - the y coordinate of the top left corner of the text box.
public void setPosition(float x,
float y)
x - the x coordinate of the top left corner of the text box.y - the y coordinate of the top left corner of the text box.
public void setLocation(float x,
float y)
x - the x coordinate of the top left corner of the text box.y - the y coordinate of the top left corner of the text box.public float getX()
public float getY()
public void setWidth(double width)
width - the specified width.public void setWidth(float width)
width - the specified width.public float getWidth()
public void setHeight(double height)
height - the specified height.public void setHeight(float height)
height - the specified height.public float getHeight()
public void setMargin(double margin)
margin - the margin between the text and the boxpublic void setMargin(float margin)
margin - the margin between the text and the boxpublic float getMargin()
public void setLineWidth(double lineWidth)
lineWidth - doublepublic void setLineWidth(float lineWidth)
lineWidth - floatpublic float getLineWidth()
public void setSpacing(double spacing)
spacing - the spacingpublic void setSpacing(float spacing)
spacing - public float getSpacing()
public void setBgColor(int color)
color - the color specified as 0xRRGGBB integer.public void setBgColor(int[] color)
color - the color specified as array of integer values from 0x00 to 0xFF.public void setBgColor(double[] color)
color - the color specified as array of double values from 0.0 to 1.0.public int getBgColor()
public void setFgColor(int color)
color - the color specified as 0xRRGGBB integer.public void setFgColor(int[] color)
color - the color specified as 0xRRGGBB integer.public void setFgColor(double[] color)
color - the color specified as an array of double values from 0.0 to 1.0.public void setPenColor(int color)
color - the color specified as 0xRRGGBB integer.public void setPenColor(int[] color)
color - the color specified as an array of int values from 0x00 to 0xFF.public void setPenColor(double[] color)
color - the color specified as an array of double values from 0.0 to 1.0.public int getPenColor()
public void setBrushColor(int color)
color - the color specified as 0xRRGGBB integer.public void setBrushColor(int[] color)
color - the color specified as an array of int values from 0x00 to 0xFF.public void setBrushColor(double[] color)
color - the color specified as an array of double values from 0.0 to 1.0.public int getBrushColor()
public void setBorder(int border,
boolean visible)
border - the border object.public boolean getBorder(int border)
public void setNoBorders()
public void setTextAlignment(int alignment)
alignment - the alignment code.
Supported values: Align.LEFT, Align.RIGHT and Align.CENTER.public int getTextAlignment()
public void setUnderline(boolean underline)
underline - the underline flag.public boolean getUnderline()
public void setStrikeout(boolean strikeout)
strikeout - the strikeout flag.public boolean getStrikeout()
public void setFallbackFont(Font font)
public void setVerticalAlignment(int alignment)
alignment - - valid values areAlign.TOP, Align.BOTTOM and Align.CENTERpublic int getVerticalAlignment()
public void setTextColors(java.util.Map<java.lang.String,java.lang.Integer> colors)
public float[] drawOn(Page page)
throws java.lang.Exception
drawOn in interface Drawablepage - the Page where the TextBox is to be drawn.
java.lang.Exception
public float[] drawOn(Page page,
boolean draw)
throws java.lang.Exception
page - the Page where the TextBox is to be drawn.draw - flag specifying if this component should actually be drawn on the page.
java.lang.Exception