| javax.swing.JPanel com.sun.pdfview.ThumbPanel
ThumbPanel | public class ThumbPanel extends JPanel implements Runnable,Scrollable,ImageObserver(Code) | | A panel of thumbnails, one for each page of a PDFFile. You can add
a PageChangeListener to be informed of when the user clicks one of the
pages.
|
Inner Class :class GotoLater implements Runnable | |
Constructor Summary | |
public | ThumbPanel(PDFFile file) Creates a new ThumbPanel based on a PDFFile. |
Method Summary | |
public void | addPageChangeListener(PageChangeListener pl) Adds a PageChangeListener to receive notification of page clicks. | public Dimension | getPreferredScrollableViewportSize() | public int | getScrollableBlockIncrement(Rectangle visrect, int orientation, int direction) | public boolean | getScrollableTracksViewportHeight() | public boolean | getScrollableTracksViewportWidth() | public int | getScrollableUnitIncrement(Rectangle visrect, int orientation, int direction) | public void | handleClick(int x, int y) Handles a mouse click in the panel. | public boolean | imageUpdate(Image img, int infoflags, int x, int y, int width, int height) Handles notification of any image updates. | public void | pageShown(int pagenum) Sets the currently viewed page, indicates it with a highlight
border, and makes sure the thumbnail is visible. | public void | paint(Graphics g) Updates the positions of the thumbnails, and draws them to the
screen. | public void | removePageChangeListener(PageChangeListener pl) Removes a PageChangeListener from the notification list. | public void | run() Renders each of the pages in the PDFFile into a thumbnail. | public void | setDefaultWidth(int width) Sets the default width of an un-processed thumbnail. | public void | showPage(int pagenum) Notifies the listeners that a page has been selected. | public void | stop() Stops the render thread. |
anim | Thread anim(Code) | | Thread that renders each thumbnail in turn
|
border | int border(Code) | | Size of the border between images
|
defaultNotSet | boolean defaultNotSet(Code) | | Whether the default width has been guesstimated for this PDFFile
yet.
|
defaultWidth | int defaultWidth(Code) | | Guesstimate of the width of a thumbnail that hasn't been processed
yet.
|
images | Image images(Code) | | Array of images, one per page in the file
|
lineheight | int lineheight(Code) | | Height of each line. Thumbnails will be scaled to this height
(minus the border).
|
needdrawn | int needdrawn(Code) | | Which thumbnail needs to be drawn next, or -1 if the previous
needy thumbnail is being processed.
|
showing | int showing(Code) | | Which thumbnail is selected, or -1 if no thumbnail selected.
|
xloc | int xloc(Code) | | Array of the x locations of each of the thumbnails. Every 0 stored
in this array indicates the start of a new line of thumbnails.
|
ThumbPanel | public ThumbPanel(PDFFile file)(Code) | | Creates a new ThumbPanel based on a PDFFile. The file may be null.
Automatically starts rendering thumbnails for that file.
|
addPageChangeListener | public void addPageChangeListener(PageChangeListener pl)(Code) | | Adds a PageChangeListener to receive notification of page clicks.
|
getPreferredScrollableViewportSize | public Dimension getPreferredScrollableViewportSize()(Code) | | |
getScrollableBlockIncrement | public int getScrollableBlockIncrement(Rectangle visrect, int orientation, int direction)(Code) | | |
getScrollableTracksViewportHeight | public boolean getScrollableTracksViewportHeight()(Code) | | |
getScrollableTracksViewportWidth | public boolean getScrollableTracksViewportWidth()(Code) | | |
getScrollableUnitIncrement | public int getScrollableUnitIncrement(Rectangle visrect, int orientation, int direction)(Code) | | |
handleClick | public void handleClick(int x, int y)(Code) | | Handles a mouse click in the panel. Figures out which page was
clicked, and calls showPage.
Parameters: x - the x coordinate of the mouse click Parameters: y - the y coordinate of the mouse click |
imageUpdate | public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)(Code) | | Handles notification of any image updates. Not used any more.
|
pageShown | public void pageShown(int pagenum)(Code) | | Sets the currently viewed page, indicates it with a highlight
border, and makes sure the thumbnail is visible.
|
paint | public void paint(Graphics g)(Code) | | Updates the positions of the thumbnails, and draws them to the
screen.
|
removePageChangeListener | public void removePageChangeListener(PageChangeListener pl)(Code) | | Removes a PageChangeListener from the notification list.
|
run | public void run()(Code) | | Renders each of the pages in the PDFFile into a thumbnail.
Preferentially works on the needdrawn thumbnail, otherwise, go in
order.
|
setDefaultWidth | public void setDefaultWidth(int width)(Code) | | Sets the default width of an un-processed thumbnail.
Parameters: width - the width of an unknown thumbnail, in pixels. |
showPage | public void showPage(int pagenum)(Code) | | Notifies the listeners that a page has been selected. Performs
the notification in the AWT thread.
Also highlights the selected page. Does this first so that feedback
is immediate.
|
stop | public void stop()(Code) | | Stops the render thread. Be sure to call this before dropping
a ThumbPanel.
|
|
|