站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

PrintPreferences (Text API) - NetBeans API Javadoc (Current Development Version)

org.openide.text 6.16

org.openide.text
Class PrintPreferences

java.lang.Object
  extended by org.openide.text.PrintPreferences

public final class PrintPreferences
extends Object

Allows get, set properties that specify the look of a printed Source Editor page, including headers, footers, vertical spacing, and line numbers.

Since:
6.16

Nested Class Summary
static class PrintPreferences.Alignment
          Constants for center, right, left position of page header, footer.
 
Method Summary
static PrintPreferences.Alignment getFooterAlignment()
           
static Font getFooterFont()
           
static String getFooterFormat()
          See setFooterFormat(java.lang.String)
static PrintPreferences.Alignment getHeaderAlignment()
           
static Font getHeaderFont()
           
static String getHeaderFormat()
          See setHeaderFormat(java.lang.String)
static float getLineAscentCorrection()
           
static PageFormat getPageFormat(PrinterJob pj)
          Get an instance of PageFormat.
static boolean getWrap()
          Wrap lines.
static void setFooterAlignment(PrintPreferences.Alignment alignment)
           
static void setFooterFont(Font f)
           
static void setFooterFormat(String s)
          Set the text for the page footer.
static void setHeaderAlignment(PrintPreferences.Alignment alignment)
           
static void setHeaderFont(Font f)
           
static void setHeaderFormat(String s)
          Set the text for the page header.
static void setLineAscentCorrection(float correction)
           
static void setPageFormat(PageFormat pf)
           
static void setWrap(boolean wrap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPageFormat

public static PageFormat getPageFormat(PrinterJob pj)
Get an instance of PageFormat.

Parameters:
pj - PrinterJob which is associated with the default printer.
Returns:
an instance of PageFormat that describes the size and orientation of a page to be printed.

setPageFormat

public static void setPageFormat(PageFormat pf)
Parameters:
pf - PageFormat that describes the size and orientation of a page to be printed

getWrap

public static boolean getWrap()
Wrap lines.

Returns:
true if lines that are too long for the page size will be wrapped to the following line. If false is returned, then long lines will be truncated.

setWrap

public static void setWrap(boolean wrap)
Parameters:
wrap - See getWrap()

getHeaderFormat

public static String getHeaderFormat()
See setHeaderFormat(java.lang.String)

Returns:
the text for the page header

setHeaderFormat

public static void setHeaderFormat(String s)
Set the text for the page header. The following special characters can be used:
  • {0} is replaced with the page number.
  • {1} is replaced with the date and time.
  • {2} is replaced with the file name.

Parameters:
s - the text for the page header

getFooterFormat

public static String getFooterFormat()
See setFooterFormat(java.lang.String)

Returns:
the text for the page footer

setFooterFormat

public static void setFooterFormat(String s)
Set the text for the page footer. The following special characters can be used:
  • {0} is replaced with the page number.
  • {1} is replaced with the date and time.
  • {2} is replaced with the file name.

Parameters:
s - the text for the page footer

getHeaderFont

public static Font getHeaderFont()
Returns:
the font for the header

setHeaderFont

public static void setHeaderFont(Font f)
Parameters:
f - the font for the header

getFooterFont

public static Font getFooterFont()
Returns:
the font for the footer

setFooterFont

public static void setFooterFont(Font f)
Parameters:
f - the font for the footer

getHeaderAlignment

public static PrintPreferences.Alignment getHeaderAlignment()
Returns:
information whether the header is centered, left aligned, or right aligned.

setHeaderAlignment

public static void setHeaderAlignment(PrintPreferences.Alignment alignment)
Parameters:
alignment - whether the header should be centered, left aligned, or right aligned.

getFooterAlignment

public static PrintPreferences.Alignment getFooterAlignment()
Returns:
whether the footer is centered, left aligned, or right aligned.

setFooterAlignment

public static void setFooterAlignment(PrintPreferences.Alignment alignment)
Parameters:
alignment - whether the footer should be centered, left aligned, or right aligned.

getLineAscentCorrection

public static float getLineAscentCorrection()
Returns:
the amount of vertical space to print between lines.

setLineAscentCorrection

public static void setLineAscentCorrection(float correction)
Parameters:
correction - the amount of vertical space to print between lines.
Throws:
IllegalArgumentException - if correction is less than 0.

org.openide.text 6.16

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.