|
Side of Software Print Preview Library 1.8.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 | +--sos.preview.JPrintPreviewPane
A component that displays printable pages.
The print preview pane is intended to show the user what his or her document looks like in a paged format ready to be sent to the printer. It does not allow any editing of the pages.
From the print preview pane, the user can:
JPrintPreviewPane
automatically installs its own component descendants
based on the pageable property. Clients need not invoke methods like
add
, remove
, and removeAll
.
The installed page components may not necessarily be the direct children of this print
preview pane. Therefore, clients should not invoke methods like
getComponent
and findComponentAt
to
retrieve page components. Instead,
they should use the methods getPageComponent
and getPageIndexAt
. This class uses JPrintPreviewPage
components to render its pages.
Subclasses, however, may change this behavior by overriding createPageComponent
.
Consequently, clients should not rely on specific types of the objects returned by
getPageComponent
.
The print preview pane's scrolling behavior typically depends on its layout.
Therefore, if its layout implements ScrollableLayoutManager
, it
delegates all javax.swing.Scrollable
methods to its layout; otherwise, it
returns default values.
Clients may respond to changes to a JPrintPreviewPane
by registering a
property change listener and listening for any of the following
properties:
LAYOUT_PROPERTY | The page layout manager has changed. |
MARGINS_ARE_SHOWN_PROPERTY | Page margins are now displayed or are no longer displayed. |
MODE_PROPERTY | The mode has changed. |
PAGEABLE_PROPERTY | The pages to preview have changed. |
PAGE_NUMBER_RENDERER_PROPERTY | The page number renderer has changed. |
PAGE_NUMBERS_ARE_SHOWN_PROPERTY | Page numbers are now displayed or are no longer displayed. |
PAGE_SELECTION_ALLOWED_PROPERTY | Page selection is now allowed or is no longer allowed. |
SCALE_PROPERTY | The amount the pages are scaled has changed. |
SELECTION_BACKGROUND_PROPERTY | The selection background color has changed. |
SELECTION_FOREGROUND_PROPERTY | The selection foreground color has changed. |
SELECTION_MODEL_PROPERTY | The page selection model has changed. |
ZOOM_FUNCTION_PROPERTY | The zoom function has changed. |
Color getSelectionBackground() void setSelectionBackground(Color selectionBackground) Color getSelectionForeground() void setSelectionForeground(Color selectionForeground) void setPageNumberRenderer(PageNumberRenderer renderer) void setPageNumbersAreShown(boolean pageNumbersAreShown) boolean getPageNumbersAreShown() PageNumberRenderer getPageNumberRenderer() boolean getMarginsAreShown() void setMarginsAreShown(boolean marginsAreShown)
double getScale() void setLayout(LayoutManager layout) boolean zoom(double scale) boolean zoom(double scale,Point point) boolean zoomIn() void zoomIn(int pageIndex) boolean zoomIn(Point point) boolean zoomOut() void zoomOut(int pageIndex) boolean zoomOut(Point point) void centerPage(int pageIndex) void ensurePageIsVisible(int pageIndex) ZoomFunction getZoomFunction() void setZoomFunction(ZoomFunction zoomFunction)
boolean isPageSelected(int pageIndex) boolean getPageSelectionAllowed() ListSelectionModel getPageSelectionModel() void setPageSelectionModel(ListSelectionModel selectionModel) int getSelectedPageIndex() void setPageSelectionAllowed()
PageFormat pageSetup(int pageIndex) boolean print() void printAll()
For more information on how to use and customize a JPrintPreviewPane
,
see Side of Software's online tutorial.
ScrollableLayoutManager
,
JPrintPreviewPage
Nested Class Summary | |
protected class |
JPrintPreviewPane.AccessibleJPrintPreviewPane
A class that implements accessibility support for a JPrintPreviewPane . |
Field Summary | |
static java.lang.String |
LAYOUT_PROPERTY
Constant used by property change events to signal that the a JPrintPreviewPane 's layout manager has changed. |
static java.lang.String |
MARGINS_ARE_SHOWN_PROPERTY
Constant used by property change events to signal that the a JPrintPreviewPane has changed whether or not it draws margins. |
static java.lang.String |
MODE_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's mode has changed. |
static java.lang.String |
PAGE_NUMBER_RENDERER_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane has changed the way it renders page numbers. |
static java.lang.String |
PAGE_NUMBERS_ARE_SHOWN_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane changed whether or not it displays
page numbers. |
static java.lang.String |
PAGE_SELECTION_ALLOWED_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane changed whether or not it allows
its pages to be selected. |
static java.lang.String |
PAGEABLE_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's underlying pages have changed. |
static java.lang.String |
SCALE_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's scale has changed. |
static java.lang.String |
SELECTION_BACKGROUND_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's selection background color has changed. |
static java.lang.String |
SELECTION_FOREGROUND_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's selection foreground color has changed. |
static int |
SELECTION_MODE
Constant used for setMode that means the print preview
pane is prepared to select its pages. |
static java.lang.String |
SELECTION_MODEL_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's selection model has changed. |
static java.lang.String |
ZOOM_FUNCTION_PROPERTY
Constant used by property change events to signal that a JPrintPreviewPane 's zoom function has changed. |
static int |
ZOOM_IN_MODE
Constant used for setMode that means the print preview
pane is prepared to zoom in. |
static int |
ZOOM_MODE
Constant used for setMode that means the print preview
pane is prepared to zoom in and out. |
static int |
ZOOM_OUT_MODE
Constant used for setMode that means the print preview
pane is prepared to zoom out. |
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 | |
JPrintPreviewPane()
Creates a JPrintPreviewPane with zero pages. |
|
JPrintPreviewPane(java.awt.print.Pageable pageable)
Creates a JPrintPreviewPane with the specified pages laid
out one page at a time. |
|
JPrintPreviewPane(java.awt.print.Pageable pageable,
java.awt.LayoutManager pageLayout)
Creates a JPrintPreviewPane with the specified pages laid
out by the specified layout manager. |
Method Summary | |
void |
centerPage(int pageIndex)
Centers the page given by pageIndex the best it can. |
protected ZoomFunction |
createDefaultZoomFunction()
Creates and returns a default zoom function. |
protected java.awt.Component |
createPageComponent(java.awt.print.Printable page,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Creates and returns a graphical component for the specified page. |
protected PageNumberRenderer |
createPageNumberRenderer()
Creates and returns a default page number renderer. |
protected javax.swing.ListSelectionModel |
createPageSelectionModel()
Creates and returns a default page selection model. |
void |
doLayout()
Causes this container to lay out its components. |
void |
ensurePageIsVisible(int pageIndex)
Scrolls this print preview pane as necessary to ensure that a portion of the specified page is visible. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JPrintPreviewPane . |
boolean |
getMarginsAreShown()
Returns true if this object should display page margins. |
int |
getMode()
Return this print preview pane's mode--either ZOOM_MODE ,
ZOOM_IN_MODE ,
ZOOM_OUT_MODE , or SELECTION_MODE . |
java.awt.print.Pageable |
getPageable()
Returns the pages displayed by this print preview pane. |
java.awt.Component |
getPageComponent(int pageIndex)
Returns the component that is used to render the specified page. |
int |
getPageIndexAt(int x,
int y)
Returns the index of the page that lies at the specified point, or -1 if no such page exists. |
int |
getPageIndexAt(java.awt.Point point)
Returns the index of the page that lies at the specified point, or -1 if no such page exists. |
PageNumberRenderer |
getPageNumberRenderer()
Returns the object that knows how to render the page numbers, or null
if no such object exists. |
boolean |
getPageNumbersAreShown()
Returns true if this object should display page numbers. |
boolean |
getPageSelectionAllowed()
Returns true if pages can be selected. |
javax.swing.ListSelectionModel |
getPageSelectionModel()
Returns the way pages are selected in this print preview pane. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
java.awt.Dimension |
getPreferredSize()
Returns this component's preferred size. |
double |
getScale()
Returns the amount the pages are being scaled. |
int |
getScrollableBlockIncrement(java.awt.Rectangle rectangle,
int orientation,
int direction)
Returns the scrollable block increment. |
boolean |
getScrollableTracksViewportHeight()
Returns true if a viewport should always force
this component's height to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Returns true if a viewport should always force
this component's width to match the width of the viewport. |
int |
getScrollableUnitIncrement(java.awt.Rectangle rectangle,
int orientation,
int direction)
Returns the scrollable unit increment. |
int |
getSelectedPageIndex()
Returns the index of the first selected page, or -1 if no selection exists. |
java.awt.Color |
getSelectionBackground()
Returns the selection background color. |
java.awt.Color |
getSelectionForeground()
Returns the selection foreground color. |
PrintPreviewPaneUI |
getUI()
Returns the look and feel delegate that renders this object. |
java.lang.String |
getUIClassID()
Returns the UIDefaults key used to look up the name
of the swing.plaf.ComponentUI class that defines the look and feel
for this component. |
ZoomFunction |
getZoomFunction()
Returns the object that controls the amount of zooming. |
boolean |
isPageSelected(int pageIndex)
Returns true if the page corresponding to
pageIndex is selected. |
java.awt.print.PageFormat |
pageSetup(int pageIndex)
Displays the page setup dialog and returns the new page format, or null
if the user cancelled the dialog. |
boolean |
print()
Sends pages to the printer by way of the print dialog. |
void |
printAll()
Sends all pages to the printer without showing the print dialog. |
void |
setLayout(java.awt.LayoutManager layout)
Sets the layout manager for this print preview pane. |
void |
setMarginsAreShown(boolean marginsAreShown)
Sets whether or not the margins are drawn on the print preview pages. |
void |
setMode(int mode)
Sets the print preview mode. |
void |
setPageable(java.awt.print.Pageable pageable)
Sets the pages to be displayed by this print preview pane. |
void |
setPageNumberRenderer(PageNumberRenderer pageNumberRenderer)
Sets the page number renderer for this print preview pane. |
void |
setPageNumbersAreShown(boolean pageNumbersAreShown)
Sets whether or not this print preview pane should render page numbers. |
void |
setPageSelectionAllowed(boolean pageSelectionAllowed)
Sets whether or not pages in this print preview pane can be selected. |
void |
setPageSelectionModel(javax.swing.ListSelectionModel selectionModel)
Set the page selection model. |
void |
setSelectionBackground(java.awt.Color selectionBackground)
Sets the selection background color. |
void |
setSelectionForeground(java.awt.Color selectionForeground)
Sets the selection foreground color. |
void |
setUI(PrintPreviewPaneUI newUI)
Sets the look and feel delegate for this print preview pane. |
void |
setZoomFunction(ZoomFunction zoomFunction)
Sets the zoom function, which is used to determine how much the print preview should zoom. |
void |
updateUI()
Resets the UI property with the value from the current look and feel. |
boolean |
zoom(double scale)
Zooms the pages within this print preview pane to the specified scale. |
boolean |
zoom(double scale,
java.awt.Point point)
Zooms the pages within this print preview pane to the specified scale, centering on the specified point. |
boolean |
zoomIn()
Zooms in on the pages within this print preview pane. |
void |
zoomIn(int pageIndex)
Zooms in on the specified page. |
boolean |
zoomIn(java.awt.Point point)
Zooms in on the pages within this print preview pane, centering on the specified point. |
boolean |
zoomOut()
Zooms out on the pages within this print preview pane. |
void |
zoomOut(int pageIndex)
Zooms out on the specified page. |
boolean |
zoomOut(java.awt.Point point)
Zooms out on the pages within this print preview pane, centering on the specified point. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SELECTION_MODE
setMode
that means the print preview
pane is prepared to select its pages.
public static final int ZOOM_MODE
setMode
that means the print preview
pane is prepared to zoom in and out.
public static final int ZOOM_IN_MODE
setMode
that means the print preview
pane is prepared to zoom in.
public static final int ZOOM_OUT_MODE
setMode
that means the print preview
pane is prepared to zoom out.
public static final java.lang.String LAYOUT_PROPERTY
JPrintPreviewPane
's layout manager has changed.
public static final java.lang.String MARGINS_ARE_SHOWN_PROPERTY
JPrintPreviewPane
has changed whether or not it draws margins.
public static final java.lang.String MODE_PROPERTY
JPrintPreviewPane
's mode has changed.
public static final java.lang.String PAGEABLE_PROPERTY
JPrintPreviewPane
's underlying pages have changed.
public static final java.lang.String PAGE_NUMBER_RENDERER_PROPERTY
JPrintPreviewPane
has changed the way it renders page numbers.
public static final java.lang.String PAGE_NUMBERS_ARE_SHOWN_PROPERTY
JPrintPreviewPane
changed whether or not it displays
page numbers.
public static final java.lang.String PAGE_SELECTION_ALLOWED_PROPERTY
JPrintPreviewPane
changed whether or not it allows
its pages to be selected.
public static final java.lang.String SCALE_PROPERTY
JPrintPreviewPane
's scale has changed.
public static final java.lang.String SELECTION_BACKGROUND_PROPERTY
JPrintPreviewPane
's selection background color has changed.
public static final java.lang.String SELECTION_FOREGROUND_PROPERTY
JPrintPreviewPane
's selection foreground color has changed.
public static final java.lang.String SELECTION_MODEL_PROPERTY
JPrintPreviewPane
's selection model has changed.
public static final java.lang.String ZOOM_FUNCTION_PROPERTY
JPrintPreviewPane
's zoom function has changed.
Constructor Detail |
public JPrintPreviewPane()
JPrintPreviewPane
with zero pages.
public JPrintPreviewPane(java.awt.print.Pageable pageable) throws java.lang.NullPointerException
JPrintPreviewPane
with the specified pages laid
out one page at a time.
pageable
- the pages to be viewed in the print preview pane
java.lang.NullPointerException
- if pageable
is null
public JPrintPreviewPane(java.awt.print.Pageable pageable, java.awt.LayoutManager pageLayout) throws java.lang.NullPointerException
JPrintPreviewPane
with the specified pages laid
out by the specified layout manager.
pageable
- the pages to be viewed in the print preview panepageLayout
- layout that will organize the pages in the pane
java.lang.NullPointerException
- if pageable
is null
Method Detail |
public void centerPage(int pageIndex) throws java.lang.IllegalArgumentException
pageIndex
the best it can.
pageIndex
- page to be centered
java.lang.IllegalArgumentException
- if pageIndex
is less than 0 or greather
than the number of pages - 1protected ZoomFunction createDefaultZoomFunction()
protected java.awt.Component createPageComponent(java.awt.print.Printable page, java.awt.print.PageFormat pageFormat, int pageIndex)
JPrintPreviewPage
for the page components.
page
- the object that renders the contents of the pagepageFormat
- the size, layout, and margins of the pagepageIndex
- the index of the page
protected PageNumberRenderer createPageNumberRenderer()
protected javax.swing.ListSelectionModel createPageSelectionModel()
public void doLayout()
doLayout
in class java.awt.Container
public void ensurePageIsVisible(int pageIndex) throws java.lang.IllegalArgumentException
pageIndex
- page to be made visible
java.lang.IllegalArgumentException
- if pageIndex
is less than 0 or greather
than the number of pages - 1public javax.accessibility.AccessibleContext getAccessibleContext()
AccessibleContext
associated with this JPrintPreviewPane
.
getAccessibleContext
in interface javax.accessibility.Accessible
getAccessibleContext
in class javax.swing.JComponent
AccessibleContext
associated with this JPrintPreviewPane
public boolean getMarginsAreShown()
true
if this object should display page margins.
true
if page margins are shownsetMarginsAreShown(boolean)
public int getMode()
ZOOM_MODE
,
ZOOM_IN_MODE
,
ZOOM_OUT_MODE
, or SELECTION_MODE
.
setMode(int)
public java.awt.Component getPageComponent(int pageIndex) throws java.lang.IndexOutOfBoundsException
pageIndex
- the index of the page whose component is desired
pageIndex
java.lang.IndexOutOfBoundsException
- if pageIndex
is less than 0 or greather
than the number of pages - 1public int getPageIndexAt(java.awt.Point point) throws java.lang.NullPointerException
point
- the point at which to look for a page
java.lang.NullPointerException
- if point
is null
getPageIndexAt(int,int)
public int getPageIndexAt(int x, int y)
x
- offset along the x axisy
- offset along the y axis
getPageIndexAt(Point)
public java.awt.print.Pageable getPageable()
setPageable(java.awt.print.Pageable)
public PageNumberRenderer getPageNumberRenderer()
null
if no such object exists.
null
)setPageNumberRenderer(sos.preview.PageNumberRenderer)
public boolean getPageNumbersAreShown()
true
if this object should display page numbers.
true
if page numbers are shownsetPageNumbersAreShown(boolean)
public boolean getPageSelectionAllowed()
true
if pages can be selected.
true
if pages can be selectedsetPageSelectionAllowed(boolean)
public javax.swing.ListSelectionModel getPageSelectionModel()
setPageSelectionModel(javax.swing.ListSelectionModel)
public java.awt.Dimension getPreferredScrollableViewportSize()
ScrollableLayoutManager
, the request
gets forwarded to it.
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
JViewport
whose view
is this Scrollable
ScrollableLayoutManager.getPreferredScrollableViewportSize(java.awt.Container)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public double getScale()
setLayout(java.awt.LayoutManager)
public int getScrollableBlockIncrement(java.awt.Rectangle rectangle, int orientation, int direction)
ScrollableLayoutManager
, this request gets forwared to it.
getScrollableBlockIncrement
in interface javax.swing.Scrollable
rectangle
- The view area visible within the viewportorientation
- The axis of the scrolling--either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- A negative number to indicate scrolling left or up, or
a positive number to indicate scrolling right or down
ScrollableLayoutManager.getScrollableBlockIncrement(java.awt.Container, java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportHeight()
true
if a viewport should always force
this component's height to match the height of the viewport.
If the current layout manager
implements ScrollableLayoutManager
, this request gets forwared to it.
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
true
if a viewport should keep the
container
's height the same height of the viewportScrollableLayoutManager.getScrollableTracksViewportHeight(java.awt.Container)
public boolean getScrollableTracksViewportWidth()
true
if a viewport should always force
this component's width to match the width of the viewport.
If the current layout manager
implements ScrollableLayoutManager
, this request gets forwared to it.
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
true
if a viewport should keep the
container
's width the same width of the viewportScrollableLayoutManager.getScrollableTracksViewportWidth(java.awt.Container)
public int getScrollableUnitIncrement(java.awt.Rectangle rectangle, int orientation, int direction)
ScrollableLayoutManager
, this request gets forwared to it.
getScrollableUnitIncrement
in interface javax.swing.Scrollable
rectangle
- The view area visible within the viewportorientation
- The axis of the scrolling--either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- A negative number to indicate scrolling left or up, or
a positive number to indicate scrolling right or down
ScrollableLayoutManager.getScrollableUnitIncrement(java.awt.Container, java.awt.Rectangle, int, int)
public int getSelectedPageIndex()
public java.awt.Color getSelectionBackground()
setSelectionBackground(java.awt.Color)
public java.awt.Color getSelectionForeground()
setSelectionForeground(java.awt.Color)
public PrintPreviewPaneUI getUI()
public java.lang.String getUIClassID()
UIDefaults
key used to look up the name
of the swing.plaf.ComponentUI
class that defines the look and feel
for this component.
getUIClassID
in class javax.swing.JComponent
UIDefaults
key for a ComponentUI
subclasspublic ZoomFunction getZoomFunction()
setZoomFunction(sos.preview.ZoomFunction)
public boolean isPageSelected(int pageIndex)
true
if the page corresponding to
pageIndex
is selected. This is equivalent
to testing the page selection model (if one exists) for selection.
pageIndex
- page to test for selection
true
if the specified page is selectedpublic java.awt.print.PageFormat pageSetup(int pageIndex) throws java.lang.IllegalArgumentException
null
if the user cancelled the dialog.
pageIndex
- the index of the page whose page format is to be shown
in the dialog, or -1 if the default page format should be used
null
if the user did
not accept the dialog
java.lang.IllegalArgumentException
- if pageIndex
is not -1 or a valid
page indexpublic boolean print() throws java.awt.print.PrinterException
true
if something was printed
java.awt.print.PrinterException
- an error in the print system caused the
page to be abortedprintAll()
public void printAll() throws java.awt.print.PrinterException
java.awt.print.PrinterException
- an error in the print system caused the
page to be abortedprint()
public void setLayout(java.awt.LayoutManager layout)
setLayout
in class java.awt.Container
layout
- the desired layout managerpublic void setMarginsAreShown(boolean marginsAreShown)
marginsAreShown
- true
if the page components should show the marginsgetMarginsAreShown()
public void setMode(int mode) throws java.lang.IllegalArgumentException
mode
- desired print preview mode
java.lang.IllegalArgumentException
- if mode is not one of
SELECTION_MODE
, ZOOM_MODE
,
ZOOM_IN_MODE
, or ZOOM_OUT_MODE
getMode()
public void setPageable(java.awt.print.Pageable pageable) throws java.lang.NullPointerException
pageable
object may contain any number of pages.
pageable
- contents of the pages to be rendered (may not be null
)
java.lang.NullPointerException
- if pageable
is null
getPageable()
public void setPageNumberRenderer(PageNumberRenderer pageNumberRenderer)
pageNumberRenderer
- object that can draw the page numbers for
each page in this print preview panegetPageNumberRenderer()
public void setPageNumbersAreShown(boolean pageNumbersAreShown)
pageNumbersAreShown
- true
if page numbers should be showngetPageNumbersAreShown()
public void setPageSelectionAllowed(boolean pageSelectionAllowed)
pageSelectionAllowed
- true
if pages can be selectedgetPageSelectionAllowed()
public void setPageSelectionModel(javax.swing.ListSelectionModel selectionModel)
selectionModel
- desired page selection behaviorgetPageSelectionModel()
public void setSelectionBackground(java.awt.Color selectionBackground)
selectionBackground
- desired selection background colorgetSelectionBackground()
public void setSelectionForeground(java.awt.Color selectionForeground)
selectionForeground
- desired selection foreground colorgetSelectionForeground()
public void setZoomFunction(ZoomFunction zoomFunction) throws java.lang.NullPointerException
zoomFunction
- an object that dictates how far the print preview pane
should zoom in or out at each zoom step
java.lang.NullPointerException
- if zoomFunction
is null
getZoomFunction()
public void setUI(PrintPreviewPaneUI newUI)
newUI
- the new UI delegatepublic void updateUI()
updateUI
in class javax.swing.JComponent
public boolean zoom(double scale) throws java.lang.IllegalArgumentException
scale
- the amount to scale the pages
true
if zooming occurred
java.lang.IllegalArgumentException
- if scale <= 0.0
zoom(double,Point)
public boolean zoom(double scale, java.awt.Point point) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
scale
- the amount to scale the pagespoint
- point on a page component for which to center the new view
true
if zooming occurred
java.lang.IllegalArgumentException
- if scale <= 0.0
java.lang.NullPointerException
- if point
is null
zoom(double)
public boolean zoomIn()
true
if zooming occurredpublic void zoomIn(int pageIndex) throws java.lang.IllegalArgumentException
pageIndex
- index of the page to zoom in on
java.lang.IllegalArgumentException
- if pageIndex
is less than 0 or greather
than the number of pages - 1public boolean zoomIn(java.awt.Point point) throws java.lang.NullPointerException
point
- point on a page component to zoom in on
true
if zooming occurred
java.lang.NullPointerException
- if point
is null
public boolean zoomOut()
true
if zooming occurredpublic void zoomOut(int pageIndex) throws java.lang.IllegalArgumentException
pageIndex
- index of the page to zoom out on
java.lang.IllegalArgumentException
- if pageIndex
is less than 0 or greather
than the number of pages - 1public boolean zoomOut(java.awt.Point point) throws java.lang.NullPointerException
point
- point on a page component to zoom out on
true
if zooming occurred
java.lang.NullPointerException
- if point
is null
|
Side of Software Print Preview Library 1.8.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |