Class ThumbnailScroller

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ThumbnailScroller

public class ThumbnailScroller
extends Panel
implements MouseListener, MouseMotionListener
A concrete class for scrolling via thumbnails and scrollbars. Presently only image scrolling is available. Based on class Scroller. Java 1.1 Implementation

See Also:
ThumbnailScrollerLayout, Scroller

Constructor Index

 o ThumbnailScroller(Image)
Construction from an image.
 o ThumbnailScroller(ImageCanvas)
Construction from an ImageCanvas.

Method Index

 o getScrollPosition()
Get the current x,y position that is displayed in the scroller.
 o mouseClicked(MouseEvent)
The scroller viewport is moved to the thumbnail mouse position.
 o mouseDragged(MouseEvent)
The scroller viewport is moved to the thumbnail mouse position.
 o mouseEntered(MouseEvent)
The cursor is changed in response to the mouse moving into the thumbnail.
 o mouseExited(MouseEvent)
The cursor is changed in response to the mouse moving out of the thumbnail.
 o mouseMoved(MouseEvent)
No implementation.
 o mousePressed(MouseEvent)
No implementation.
 o mouseReleased(MouseEvent)
No implementation.
 o setScrollPosition(int, int)
Scroll to position (x,y).
 o setScrollPosition(Point)
Scroll to position (x,y).
 o update(Graphics)
Update the display screen.

Constructors

 o ThumbnailScroller
 public ThumbnailScroller(Image image)
Construction from an image. The layout manager is set to ThumbnailScrollerLayout. The desired layout could not be obtained with GridBagLayout.

See Also:
ThumbnailScrollerLayout, GridBagLayout
 o ThumbnailScroller
 public ThumbnailScroller(ImageCanvas imageCanvas)
Construction from an ImageCanvas. Adding an EventListener to a ThumbnailScroller object does not work well because most of the screen area is consumed by the image. Adding a listener to an existing ImageCanvas object and then constructing a ThumbnailScroller object is one solution. Another is a constructor which has a EventListener argument. The layout manager is set to ThumbnailScrollerLayout. The desired layout could not be obtained with GridBagLayout.

See Also:
ImageCanvas, ThumbnailScrollerLayout, GridBagLayout

Methods

 o mouseClicked
 public void mouseClicked(MouseEvent event)
The scroller viewport is moved to the thumbnail mouse position. The area in the viewport is set to the rectangle whose upper left corner corresponds to the position of the mouse click in the thumbnail.

Parameters:
event - the mouse event.
See Also:
MouseListener
 o mouseDragged
 public void mouseDragged(MouseEvent event)
The scroller viewport is moved to the thumbnail mouse position. The area in the viewport is set to the rectangle whose upper left corner corresponds to the position of the mouse click in the thumbnail.

Parameters:
event - the mouse event.
See Also:
MouseMotionListener
 o mouseEntered
 public void mouseEntered(MouseEvent event)
The cursor is changed in response to the mouse moving into the thumbnail.

Parameters:
event - the mouse event.
See Also:
MouseListener
 o mouseExited
 public void mouseExited(MouseEvent event)
The cursor is changed in response to the mouse moving out of the thumbnail. The cursor is restored to its type before entering the thumbnail.

Parameters:
event - the mouse event.
See Also:
MouseListener
 o mouseMoved
 public void mouseMoved(MouseEvent event)
No implementation.

Parameters:
event - the mouse event.
See Also:
MouseMotionListener
 o mousePressed
 public void mousePressed(MouseEvent event)
No implementation.

Parameters:
event - the mouse event.
See Also:
MouseListener
 o mouseReleased
 public void mouseReleased(MouseEvent event)
No implementation.

Parameters:
event - the mouse event.
See Also:
MouseListener
 o getScrollPosition
 public Point getScrollPosition()
Get the current x,y position that is displayed in the scroller.

Returns:
the coordinates of the current scroll position.
See Also:
Scroller, ScrollPane
 o setScrollPosition
 public void setScrollPosition(int x,
                               int y)
Scroll to position (x,y). This is a convenience method which interfaces with the scroller. In other words this is for programmatic scrolling.

Parameters:
x - scroll to this value of the horizontal scrollbar.
y - scroll to this value of the vertical scrollbar.
See Also:
Scroller, ScrollPane
 o setScrollPosition
 public void setScrollPosition(Point p)
Scroll to position (x,y). This is a convenience method which interfaces with the scroller. In other words this is for programmatic scrolling.

Parameters:
x - scroll to this value of the horizontal scrollbar.
y - scroll to this value of the vertical scrollbar.
See Also:
Scroller, ScrollPane
 o update
 public void update(Graphics g)
Update the display screen. Modified from the default action to eliminate screen flicker.

Overrides:
update in class Container