public class TLcdWatermarkPrintable extends Object implements Printable
Printable
prints a textual watermark. It is typically used to decorate an
existing Printable
. The watermark can be customized using
the following properties:
true
, the font
is scaled to make the text fit the page bounds. Otherwise, the font size is reused.Modifier and Type | Class and Description |
---|---|
static class |
TLcdWatermarkPrintable.Orientation
The orientation of the watermark.
|
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
TLcdWatermarkPrintable()
Creates a new
Printable that prints a watermark. |
Modifier and Type | Method and Description |
---|---|
Color |
getColor()
Returns the color of the watermark text.
|
Font |
getFont()
Returns the font to use for the watermark.
|
TLcdWatermarkPrintable.Orientation |
getOrientation()
Returns the orientation of the watermark.
|
Color |
getOutlineColor()
Returns the outline color of the watermark text
|
String |
getText()
Returns the watermark text.
|
boolean |
isAutoScaleText()
Returns if auto-scaling of the text is used.
|
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex) |
void |
setAutoScaleText(boolean aAutoScaleText)
Sets the auto scale property of the text.
|
void |
setColor(Color aColor)
Sets the color of the watermark text.
|
void |
setFont(Font aFont)
Sets the font to use for the watermark.
|
void |
setOrientation(TLcdWatermarkPrintable.Orientation aOrientation)
Sets the orientation of the watermark.
|
void |
setOutlineColor(Color aOutlineColor)
Sets the outline color of the watermark text.
|
void |
setText(String aText)
Sets the watermark text.
|
public TLcdWatermarkPrintable()
Printable
that prints a watermark.public void setText(String aText)
""Confidential""
.aText
- the watermark text.IllegalArgumentException
- when the text is null
or has a length of
0
.getText()
public String getText()
setText(String)
public void setOrientation(TLcdWatermarkPrintable.Orientation aOrientation)
BACK_SLASH
.aOrientation
- the orientationIllegalArgumentException
- when the orientation is null
getOrientation()
public TLcdWatermarkPrintable.Orientation getOrientation()
setOrientation(com.luciad.gui.TLcdWatermarkPrintable.Orientation)
public void setFont(Font aFont)
new Font( "Lucida Sans", Font.BOLD, 32 )
.
When isAutoScaleText()
returns true
, the size of the font will be
adjusted during printing to fit the text to the page size. So in that case the font size
is ignored. If false
the size set on the font is used.aFont
- the font to use for the watermark.IllegalArgumentException
- when the given font is null
.getFont()
public Font getFont()
setFont(java.awt.Font)
public void setAutoScaleText(boolean aAutoScaleText)
true
.
If true
the size of the text will be adjusted during printing to fit the text
to the page size. So in that case the font size is ignored. If false
the size
set on the font is used.aAutoScaleText
- true
to enable auto-scaling the font.isAutoScaleText()
public boolean isAutoScaleText()
setAutoScaleText(boolean)
public void setColor(Color aColor)
new Color( 255, 0, 0, 64 )
.aColor
- a color.IllegalArgumentException
- when to color is null
.getColor()
public Color getColor()
setColor(java.awt.Color)
public void setOutlineColor(Color aOutlineColor)
new Color( 255, 0, 0, 128 )
.
Set this color to null
to disable painting the text outline.aOutlineColor
- the outline color.getOutlineColor()
public Color getOutlineColor()
setOutlineColor(java.awt.Color)
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
print
in interface Printable
PrinterException