Class RPrintUtilities

java.lang.Object
org.fife.print.RPrintUtilities

public abstract class RPrintUtilities extends Object
A collection of static methods useful for printing text from Swing text components.
Version:
1.0
Author:
Robert Futrell
  • Constructor Details

    • RPrintUtilities

      public RPrintUtilities()
  • Method Details

    • printDocumentMonospaced

      public static int printDocumentMonospaced(Graphics g, Document doc, int fontSize, int pageIndex, PageFormat pageFormat, int tabSize)
      Prints a Document using a monospaced font, and does no word wrapping (ie, words will wrap mid-word to the next line). This method is expected to be called from Printable 'print(Graphics g)' functions.
      Parameters:
      g - The graphics context to write to.
      doc - The javax.swing.text.Document to print.
      fontSize - the point size to use for the monospaced font.
      pageIndex - The page number to print.
      pageFormat - The format to print the page with.
      tabSize - The number of spaces to expand tabs to.
      Returns:
      One of the constants from Printable.
      See Also:
    • printDocumentMonospacedWordWrap

      public static int printDocumentMonospacedWordWrap(Graphics g, Document doc, int fontSize, int pageIndex, PageFormat pageFormat, int tabSize)
      Prints a Document using a monospaced font, word wrapping on the characters ' ', '\t', '\n', ',', '.', and ';'. This method is expected to be called from Printable 'print(Graphics g)' functions.
      Parameters:
      g - The graphics context to write to.
      doc - The javax.swing.text.Document to print.
      fontSize - the point size to use for the monospaced font.
      pageIndex - The page number to print.
      pageFormat - The format to print the page with.
      tabSize - The number of spaces to expand tabs to.
      Returns:
      One of the constants from Printable.
      See Also:
    • printDocumentWordWrap

      public static int printDocumentWordWrap(Graphics g, JTextComponent textComponent, Font font, int pageIndex, PageFormat pageFormat, int tabSize)
      Prints a Document using the specified font, word wrapping on the characters ' ', '\t', '\n', ',', '.', and ';'. This method is expected to be called from Printable 'print(Graphics g)' functions.
      Parameters:
      g - The graphics context to write to.
      textComponent - The javax.swing.text.JTextComponent whose text you're printing.
      font - The font to use for printing. If null, then textComponent's font is used.
      pageIndex - The page number to print.
      pageFormat - The format to print the page with.
      tabSize - The number of spaces to convert tabs to.
      Returns:
      One of the constants from Printable.