|
FreeHEP API Version v1.1 |
|||||||||
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
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.
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 JComponent |
createPrintButton()
Creates the Print Button |
protected JComponent |
createScaleChooser()
Create the Scale chooser |
protected JToolBar |
createToolBar()
Called to create the toolbar. |
JPopupMenu |
modifyPopupMenu(JPopupMenu menu,
Component source,
Point p)
Allows a component to create or modify a popup menu |
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)
public JPopupMenu modifyPopupMenu(JPopupMenu menu, Component source, Point p)
HasPopupItems
modifyPopupMenu
in interface HasPopupItems
menu
- The menu created by the components descendentssource
- The deepest component
protected JToolBar createToolBar()
protected JComponent createCloseButton()
protected JComponent createPrintButton()
protected JComponent createScaleChooser()
|
FreeHEP API Version v1.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |