|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.zfqjava.swing.JPrintPreview
public class JPrintPreview
JPrintPreview provides a print preview component.
Client Property:
| Name | Value | Default Value |
|---|---|---|
| JPrintPreview.pageViewMode |
|
SinglePage |
| Nested Class Summary | |
|---|---|
protected class |
JPrintPreview.AccessibleJPrintPreview
This class implements accessibility support for the JPrintPreview class. |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
CLOSE_CONTROL
Type used for close button on the pane. |
static int |
COLOR
Identifies the color for print preview. |
static int |
HELP_CONTROL
Type used for help button on the pane. |
static int |
MONOCHROME
Identifies the monochrome for print preview. |
static int |
PAGE_SETUP_CONTROL
Type used for page setup button on the pane. |
static int |
PRINT_CONTROL
Type used for print button on the pane. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JPrintPreview()
Constructs a print preview component. |
|
JPrintPreview(Object printData)
Constructs a print preview component with the print data for preview. |
|
| Method Summary | |
|---|---|
void |
close()
Called by JPrintPreview when the user hits the Close button. |
protected BufferedImage |
createBufferedImage(int width,
int height,
int colorType)
Creates the buffered image for preview. |
protected JDialog |
createDialog(Component parent,
String title)
Creates a dialog for the JPrintPreview. |
protected JFrame |
createFrame(String title)
Creates a frame for the JPrintPreview. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JPrintPreview. |
int |
getColorType()
Returns the color type for print preview. |
JButton |
getControlButton(int controlType)
Gets the control button of the type. |
PrinterJob |
getDefaultPrinterJob()
Gets the PrinterJob. |
JFrame |
getFrame()
Returns the opened frame after invoke the methods showFrame() or showFrame(String). |
int |
getPageCount()
Returns the page count. |
PageFormat |
getPageFormat()
Returns the page format object current set. |
int |
getPageHeight(int index)
Returns the page height. |
BufferedImage |
getPageImage(int index)
Returns the page image used for preview. |
int |
getPageIndex()
Returns the current page index. |
int |
getPageWidth(int index)
Returns the page width. |
Object |
getPrintData()
Returns the print data for current preview. |
PrintPreviewUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
String |
getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component. |
double |
getZoomFactor()
Returns the current zoom factor. |
void |
help()
Called by JPrintPreview when the user hits the Help button. |
void |
pageSetup()
Called by JPrintPreview when the user hits the Page Setup button. |
protected String |
paramString()
Returns a string representation of this JPrintPreview. |
void |
print()
Called by JPrintPreview when the user hits the Print button. |
void |
print(Object printData)
Print the print data. |
void |
setColorType(int colorType)
Sets the color type for print preview. |
void |
setPageFormat(PageFormat pageFormat)
Sets the page format for current preview. |
void |
setPageIndex(int pageIndex)
Sets the page index to view. |
void |
setPrintData(Object printData)
Sets the print data for preview. |
void |
setUI(PrintPreviewUI ui)
Sets the look and feel (L&F) object that renders this component. |
void |
setZoomFactor(double zoomFactor)
Sets the zoom factor for view. |
void |
showApplet(Applet applet)
Shows the applet contains the JPrintPreview. |
void |
showDialog(Component parent)
Pops up a dialog contains the JPrintPreview with the
dialog having a default title. |
void |
showDialog(Component parent,
String title)
Pops up a dialog contains the JPrintPreview and with
the dialog having a title title. |
void |
showFrame()
Pops up a frame contains the JPrintPreview with the
frame having a default title. |
void |
showFrame(JFrame frame)
Shows the JPrintPreview in the specified frame. |
void |
showFrame(String title)
Pops up a frame contains the JPrintPreview and with
the frame having a title title. |
void |
showInternalFrame(JInternalFrame internalFrame)
Shows the JPrintPreview in the specified internalFrame. |
void |
updateUI()
Resets the UI property with a value from the current look and feel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int PRINT_CONTROL
public static final int PAGE_SETUP_CONTROL
public static final int HELP_CONTROL
public static final int CLOSE_CONTROL
public static final int MONOCHROME
public static final int COLOR
| Constructor Detail |
|---|
public JPrintPreview()
public JPrintPreview(Object printData)
| Method Detail |
|---|
public void updateUI()
updateUI in class JComponentJComponent.updateUI()public PrintPreviewUI getUI()
public void setUI(PrintPreviewUI ui)
ui - the PrintPreviewUI L&F objectUIDefaults.getUI(javax.swing.JComponent)public String getUIClassID()
getUIClassID in class JComponentJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public void setPrintData(Object printData)
java.awt.print.Printablejava.awt.print.Pageable
printData - the print data for previewgetPrintData()public Object getPrintData()
java.awt.print.Printablejava.awt.print.Pageable
setPrintData(java.lang.Object)public void setPageFormat(PageFormat pageFormat)
java.awt.print.Printable or
java.awt.print.Pageable, and the page format is not
null, all print method in Printable pass this parameter.
If the page format is null, use print data page format object,
if the page format for that object is null, use the default
page format object gets from default print job object.
pageFormat - the page format objectgetPageFormat()public PageFormat getPageFormat()
setPageFormat(java.awt.print.PageFormat)public void setPageIndex(int pageIndex)
pageIndex - the page indexgetPageIndex()public int getPageIndex()
setPageIndex(int)public int getPageCount()
public BufferedImage getPageImage(int index)
index - the page index
public int getPageWidth(int index)
index - the page index
public int getPageHeight(int index)
index - the page index
public void setZoomFactor(double zoomFactor)
zoomFactor - the zoom factor
IllegalAugumentException - if zoomFactor <= 0getZoomFactor()public double getZoomFactor()
setZoomFactor(double)public void setColorType(int colorType)
colorType - the color type:
getColorType()public int getColorType()
One of 2 legal values:
setColorType(int)public void showDialog(Component parent)
JPrintPreview with the
dialog having a default title.
public void showDialog(Component parent,
String title)
JPrintPreview and with
the dialog having a title title.
title - the title of the dialog
protected JDialog createDialog(Component parent,
String title)
JPrintPreview.
parent - the parent of the dialogtitle - the title of the dialogshowDialog(Component,String),
showDialog(Component)public void showFrame()
JPrintPreview with the
frame having a default title.
showDialog(Component),
showDialog(Component,String),
showFrame(String)public void showFrame(String title)
JPrintPreview and with
the frame having a title title.
title - the title of the frameshowDialog(Component),
showDialog(Component,String),
showFrame()public JFrame getFrame()
public void showFrame(JFrame frame)
JPrintPreview in the specified frame.
showDialog(java.awt.Component),
showFrame()protected JFrame createFrame(String title)
JPrintPreview.
title - the title of the frameshowFrame(),
showFrame(String)public void showInternalFrame(JInternalFrame internalFrame)
JPrintPreview in the specified internalFrame.
showDialog(java.awt.Component),
showFrame(),
showInternalFrame(javax.swing.JInternalFrame)public void showApplet(Applet applet)
JPrintPreview.
showDialog(java.awt.Component),
showFrame(),
showInternalFrame(javax.swing.JInternalFrame)public JButton getControlButton(int controlType)
controlType - the type of the button to be selected:
public void print()
JPrintPreview when the user hits the Print button.
This can also be called by the programmer.
public void print(Object printData)
printData - print the print datapublic void pageSetup()
JPrintPreview when the user hits the Page Setup button.
This can also be called by the programmer.
public void help()
JPrintPreview when the user hits the Help button.
This can also be called by the programmer.
public void close()
JPrintPreview when the user hits the Close button.
This can also be called by the programmer.
public PrinterJob getDefaultPrinterJob()
PrinterJob.
The default behavior return PrinterJob.getPrinterJob().
protected BufferedImage createBufferedImage(int width,
int height,
int colorType)
width - the image widthheight - the image heightcolorType - the image color typeprotected String paramString()
null.
paramString in class JComponentpublic AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class JComponent
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||