|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel org.freehep.application.PrintPreview
public class PrintPreview
This class can be used to add print preview capabilities to an application. Originally taken from the book Swing by Matthew Robinson and Pavel Vorobiev, Ph.D.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
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 | |
---|---|
PrintPreview()
Create an empty PrintPreview |
Method Summary | |
---|---|
protected JComponent |
createCloseButton()
Creates the Close button |
JDialog |
createDialog(Component owner)
Create a standard dialog that wraps the PrintPreview |
JDialog |
createDialog(Component owner,
String title)
Create a standard dialog that wraps the PrintPreview |
protected JPopupMenu |
createPopupMenu()
|
protected JComponent |
createPrintButton()
Creates the Print Button |
protected JComponent |
createScaleChooser()
Create the Scale chooser |
protected JToolBar |
createToolBar()
Called to create the toolbar. |
Action |
getCloseAction()
|
Action |
getPrintAction()
|
protected void |
onError(PrinterException x)
|
protected boolean |
onPrint(Pageable document)
Called if the user chooses Print. |
void |
setPageable(Pageable target)
Set a target Pageable. |
void |
setPrintable(Printable target)
Set a target Printable using the default PageFormat. |
void |
setPrintable(Printable target,
PageFormat pf)
Set a target Printable. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PrintPreview()
Method Detail |
---|
public void setPrintable(Printable target) throws PrinterException
target
- The Printable to preview
PrinterException
- If an exception occurs while trying to figure out how many pages are availablepublic void setPrintable(Printable target, PageFormat pf) throws PrinterException
target
- The Printable to previewpf
- The PageFormat to use for the pages
PrinterException
- If an exception occurs while trying to figure out how many pages are availablepublic void setPageable(Pageable target)
target
- The Pageable to previewpublic JDialog createDialog(Component owner)
owner
- The owner of the dialogpublic JDialog createDialog(Component owner, String title)
owner
- The owner of the dialogtitle
- The title of the dialogprotected boolean onPrint(Pageable document) throws PrinterException
PrinterException
protected void onError(PrinterException x)
protected JPopupMenu createPopupMenu()
protected JToolBar createToolBar()
public Action getCloseAction()
public Action getPrintAction()
protected JComponent createCloseButton()
protected JComponent createPrintButton()
protected JComponent createScaleChooser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |