📄 eventhandler.java
字号:
// $Id: EventHandler.java,v 1.2 2007/02/21 14:23:49 mike Exp $package org.faceless.pdf2.viewer;import java.awt.*;import java.util.*;import java.awt.geom.Rectangle2D;import java.awt.geom.GeneralPath;import javax.swing.*;import javax.swing.event.MouseInputListener;import java.awt.event.*;import org.faceless.pdf2.*;import org.faceless.pdf2.Event;/** * <p> * The <code>EventHandler</code> class can be extended to process mouse and keyboard * actions on a PDFViewport. We anticipate that like Acrobat, the viewer will * have several different "modes", such as text selection, clicking on annotations * and so on, and we expect a different EventHandler for each of these. * </p> * @since 2.7.8 */public class EventHandler{ /** * Parameter to the constructor indicating this handler tracks mouse click events */ public static final int TYPE_MOUSE = 1; /** * Parameter to the constructor indicating this handler tracks mouse motion events */ public static final int TYPE_MOUSEMOTION = 2; /** * Parameter to the constructor indicating this handler tracks keyboard events. */ public static final int TYPE_KEYBOARD = 4; private final int types; private PDFViewport viewport; /** * Create a new EventHandler * @param types the types of event this handler is for - a logical-or of one or * more of {@link #TYPE_MOUSE}, {@link #TYPE_MOUSEMOTION} or {@link #TYPE_KEYBOARD}. */ public EventHandler(int types) { this.types = types; } final int getType() { return types; } final void setViewport(PDFViewport viewport) { this.viewport = viewport; } /** * Return the Viewport this handler is registered to. */ public final PDFViewport getViewport() { return viewport; } /** * Called when a page is displayed in the viewport */ public void pageDisplayed(PDFNavigationEvent event) { } /** * Called when a page is hidden in the viewport */ public void pageHidden(PDFNavigationEvent page) { } /** * Called when a mouse button is pressed on a page displayed in the viewport. * Only called if the type includes {@link #TYPE_MOUSE} */ public void mousePressed(PDFMouseEvent event) { } /** * Called when a mouse button is released on a page displayed in the viewport. * Only called if the type includes {@link #TYPE_MOUSE} */ public void mouseReleased(PDFMouseEvent event) { } /** * Called when the mouse is clicked on a page displayed in the viewport. * Only called if the type includes {@link #TYPE_MOUSE} */ public void mouseClicked(PDFMouseEvent event) { } /** * Called when the mouse is moved on a page displayed in the viewport. * Only called if the type includes {@link #TYPE_MOUSEMOTION} */ public void mouseMoved(PDFMouseEvent event) { } /** * Called when the mouse is dragged on a page displayed in the viewport. * Only called if the type includes {@link #TYPE_MOUSEMOTION} */ public void mouseDragged(PDFMouseEvent event) { } /** * Called when a key is pressed in the viewport. * Only called if the type includes {@link #TYPE_KEYBOARD} */ public void keyPressed(PDFKeyEvent event) { } /** * Called when a key is released in the viewport. * Only called if the type includes {@link #TYPE_KEYBOARD} */ public void keyReleased(PDFKeyEvent event) { } /** * Called when a key is typed in the viewport. * Only called if the type includes {@link #TYPE_KEYBOARD} */ public void keyTyped(PDFKeyEvent event) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -