Class TLcdWatermarkPrintable

java.lang.Object
com.luciad.gui.TLcdWatermarkPrintable
All Implemented Interfaces:
Printable

public class TLcdWatermarkPrintable extends Object implements 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
  • Constructor Details

    • TLcdWatermarkPrintable

      public TLcdWatermarkPrintable()
      Creates a new Printable that prints a watermark.
  • Method Details

    • setText

      public void setText(String aText)
      Sets the watermark text. The default is ""Confidential"".
      Parameters:
      aText - the watermark text.
      Throws:
      IllegalArgumentException - when the text is null or has a length of 0.
      See Also:
    • getText

      public String getText()
      Returns the watermark text.
      Returns:
      the watermark text.
      See Also:
    • setOrientation

      public void setOrientation(TLcdWatermarkPrintable.Orientation aOrientation)
      Sets the orientation of the watermark. The default is BACK_SLASH.
      Parameters:
      aOrientation - the orientation
      Throws:
      IllegalArgumentException - when the orientation is null
      See Also:
    • getOrientation

      public TLcdWatermarkPrintable.Orientation getOrientation()
      Returns the orientation of the watermark.
      Returns:
      the orientation of the watermark.
      See Also:
    • setFont

      public void setFont(Font aFont)
      Sets the font to use for the watermark. The default is 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.

      Parameters:
      aFont - the font to use for the watermark.
      Throws:
      IllegalArgumentException - when the given font is null.
      See Also:
    • getFont

      public Font 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 is 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.

      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

      public void setColor(Color aColor)
      Sets the color of the watermark text. The default is new Color( 255, 0, 0, 64 ).
      Parameters:
      aColor - a color.
      Throws:
      IllegalArgumentException - when to color is null.
      See Also:
    • getColor

      public Color getColor()
      Returns the color of the watermark text.
      Returns:
      the color of the watermark text.
      See Also:
    • setOutlineColor

      public void setOutlineColor(Color aOutlineColor)
      Sets the outline color of the watermark text. The default is new Color( 255, 0, 0, 128 ).

      Set this color to null to disable painting the text outline.

      Parameters:
      aOutlineColor - the outline color.
      See Also:
    • getOutlineColor

      public Color getOutlineColor()
      Returns the outline color of the watermark text
      Returns:
      the outline color of the watermark text
      See Also:
    • print

      public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
      Specified by:
      print in interface Printable
      Throws:
      PrinterException