Package com.luciad.gui
Class TLcdWatermarkPrintable
java.lang.Object
com.luciad.gui.TLcdWatermarkPrintable
- All Implemented Interfaces:
Printable
This
Printable
prints a textual watermark. It is typically used to decorate an
existing Printable
. The watermark can be customized using
the following properties:
- text: the displayed text of the watermark
- font: the font used to paint the watermark text
- auto-scale text: when
true
, the font is scaled to make the text fit the page bounds. Otherwise, the font size is reused. - orientation: the orientation of the watermark. This can be diagonal or horizontal.
- color: the color of the watermark text.
- outline color: the outline color of the watermark text.
- Since:
- 2013.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The orientation of the watermark. -
Field Summary
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Returns the color of the watermark text.getFont()
Returns the font to use for the watermark.Returns the orientation of the watermark.Returns the outline color of the watermark textgetText()
Returns the watermark text.boolean
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
Sets the color of the watermark text.void
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
Sets the watermark text.
-
Constructor Details
-
TLcdWatermarkPrintable
public TLcdWatermarkPrintable()Creates a newPrintable
that prints a watermark.
-
-
Method Details
-
setText
Sets the watermark text. The default is""Confidential""
.- Parameters:
aText
- the watermark text.- Throws:
IllegalArgumentException
- when the text isnull
or has a length of0
.- See Also:
-
getText
Returns the watermark text.- Returns:
- the watermark text.
- See Also:
-
setOrientation
Sets the orientation of the watermark. The default isBACK_SLASH
.- Parameters:
aOrientation
- the orientation- Throws:
IllegalArgumentException
- when the orientation isnull
- See Also:
-
getOrientation
Returns the orientation of the watermark.- Returns:
- the orientation of the watermark.
- See Also:
-
setFont
Sets the font to use for the watermark. The default isnew Font( "Lucida Sans", Font.BOLD, 32 )
. WhenisAutoScaleText()
returnstrue
, 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. Iffalse
the size set on the font is used.- Parameters:
aFont
- the font to use for the watermark.- Throws:
IllegalArgumentException
- when the given font isnull
.- See Also:
-
getFont
Returns the font to use for the watermark.- Returns:
- the font to use for the watermark.
- See Also:
-
setAutoScaleText
public void setAutoScaleText(boolean aAutoScaleText) Sets the auto scale property of the text. The default istrue
. Iftrue
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. Iffalse
the size set on the font is used.- Parameters:
aAutoScaleText
-true
to enable auto-scaling the font.- See Also:
-
isAutoScaleText
public boolean isAutoScaleText()Returns if auto-scaling of the text is used.- Returns:
- if auto-scaling of the text is used.
- See Also:
-
setColor
Sets the color of the watermark text. The default isnew Color( 255, 0, 0, 64 )
.- Parameters:
aColor
- a color.- Throws:
IllegalArgumentException
- when to color isnull
.- See Also:
-
getColor
Returns the color of the watermark text.- Returns:
- the color of the watermark text.
- See Also:
-
setOutlineColor
Sets the outline color of the watermark text. The default isnew Color( 255, 0, 0, 128 )
. Set this color tonull
to disable painting the text outline.- Parameters:
aOutlineColor
- the outline color.- See Also:
-
getOutlineColor
Returns the outline color of the watermark text- Returns:
- the outline color of the watermark text
- See Also:
-
print
- Specified by:
print
in interfacePrintable
- Throws:
PrinterException
-