public final class PrintPreferences extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PrintPreferences.Alignment
Constants for center, right, left position of page header, footer.
|
Modifier and Type | Method and Description |
---|---|
static PrintPreferences.Alignment |
getFooterAlignment() |
static Font |
getFooterFont() |
static String |
getFooterFormat()
|
static PrintPreferences.Alignment |
getHeaderAlignment() |
static Font |
getHeaderFont() |
static String |
getHeaderFormat()
|
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) |
public static PageFormat getPageFormat(PrinterJob pj)
PageFormat
.pj
- PrinterJob
which is
associated with the default printer.PageFormat
that describes the size and
orientation of a page to be printed.public static void setPageFormat(PageFormat pf)
pf
- PageFormat
that describes the size and
orientation of a page to be printedpublic static boolean getWrap()
public static void setWrap(boolean wrap)
wrap
- See PrintPreferences.getWrap()
public static String getHeaderFormat()
public static void setHeaderFormat(String s)
s
- the text for the page headerpublic static String getFooterFormat()
public static void setFooterFormat(String s)
s
- the text for the page footerpublic static Font getHeaderFont()
public static void setHeaderFont(Font f)
f
- the font for the headerpublic static Font getFooterFont()
public static void setFooterFont(Font f)
f
- the font for the footerpublic static PrintPreferences.Alignment getHeaderAlignment()
public static void setHeaderAlignment(PrintPreferences.Alignment alignment)
alignment
- whether the header should be centered, left aligned, or right aligned.public static PrintPreferences.Alignment getFooterAlignment()
public static void setFooterAlignment(PrintPreferences.Alignment alignment)
alignment
- whether the footer should be centered, left aligned, or right aligned.public static float getLineAscentCorrection()
public static void setLineAscentCorrection(float correction)
correction
- the amount of vertical space to print between lines.IllegalArgumentException
- if correction is less than 0.