documentviewport.java
来自「Java生成PDF Java生成PDF Java生成PDF」· Java 代码 · 共 134 行
JAVA
134 行
// $Id: DocumentViewport.java,v 1.9 2007/05/21 15:02:59 mike Exp $package org.faceless.pdf2.viewer2;import org.faceless.pdf2.*;import java.awt.*;import java.util.*;import javax.swing.*;import java.awt.geom.*;/** * A <code>DocumentViewport</code> displays a view of a PDF inside a {@link DocumentPanel}, * although it can also be instantiated on it's own if required. It typically will contain * one or more {@link PagePanel} objects along with scrollbars and whatever else is required * to display the document in limited screen space. * See the <a href="doc-files/tutorial.html">viewer tutorial</a> for more detail on how to use this class and the "viewer" package. * <p><i>This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.</i></p> * @see PagePanel * @see DocumentPanel * @since 2.8 */public abstract class DocumentViewport extends JPanel{ private DocumentPanel docpanel; public DocumentViewport() { super(); } public DocumentViewport(LayoutManager manager) { super(manager); } /** * Set the {@link RenderingHints} that should be used when rendering the pages */ public abstract void setRenderingHints(RenderingHints hints); /** * Set the currently displayed page. The exact implementation of this depends on * the type of viewport, but the idea is that the specified page and position * becomes the primary focus of this viewport. * @param page the page to display * @param x the left-most X position of the page, relative to {@link PagePanel#getFullPageView}. A value of NaN means keep the current value * @param y the top-most Y position of the page, relative to {@link PagePanel#getFullPageView}. A value of NaN means keep the current value * @param zoom the zoom level. A value of <= 0 or NaN means keep the current zoom. */ public abstract void setPage(PDFPage page, double x, double y, double zoom); /** * Set the zoom level of this DocumentViewport. The page and position should remain * unchanged if possible. */ public abstract void setZoom(float zoom); /** * Get the current zoom level */ public abstract float getZoom(); /** * Get the currently displayed PagePanel. As for {@link #setPage setPage()}, the exact * implementation of this method depends on the type of viewport, but the idea is * it returns the PagePanel that is the primary focus of this viewport */ public abstract PagePanel getPagePanel(); /** * Return the PDFPage in use by {@link #getPagePanel} */ public PDFPage getPage() { return getPagePanel().getPage(); } /** * Return the page that is currently in the process of rendering. If the page has * rendered this method returns the same as {@link #getPage} */ public abstract PDFPage getRenderingPage(); /** * Return the size in pixels of the space available to display pages in this viewport, * not including scrollbars or other decoration */ public abstract Dimension getViewportSize(); /** * Return the {@link DocumentPanel} this DocumentViewport is a part of */ public DocumentPanel getDocumentPanel() { return docpanel; } void setDocumentPanel(DocumentPanel panel) { this.docpanel = panel; } /** * Add a {@link PagePanelListener} to any {@link PagePanel} objects that have been * or will be created by this DocumentViewport * @param listener the listener */ public abstract void addPagePanelListener(PagePanelListener listener); /** * Remove a {@link PagePanelListener} from any {@link PagePanel} objects that have been * created by this DocumentViewport * @param listener the listener */ public abstract void removePagePanelListener(PagePanelListener listener); /** * Add a {@link PagePanelInteractionListener} to any {@link PagePanel} objects that have been * or will be created by this DocumentViewport * @param listener the listener */ public abstract void addPagePanelInteractionListener(PagePanelInteractionListener listener); /** * Remove a {@link PagePanelInteractionListener} from any {@link PagePanel} objects * that have been created by this DocumentViewport * @param listener the listener */ public abstract void removePagePanelInteractionListener(PagePanelInteractionListener listener); /** * Redraw the specified object. Typically this will call the * {@link PagePanel#redrawAnnotation} or {@link PagePanel#setPage} method * for the PagePanels in use by this Viewport, as appropriate. * @param o the Object that is to be redrawn */ public abstract void redraw(Object o);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?