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
-
ThumbnailScroller(Image)
- Construction from an image.
-
ThumbnailScroller(ImageCanvas)
- Construction from an ImageCanvas.
-
getScrollPosition()
- Get the current x,y position that is displayed in the scroller.
-
mouseClicked(MouseEvent)
- The scroller viewport is moved to the thumbnail mouse position.
-
mouseDragged(MouseEvent)
- The scroller viewport is moved to the thumbnail mouse position.
-
mouseEntered(MouseEvent)
- The cursor is changed in response to the mouse moving into the thumbnail.
-
mouseExited(MouseEvent)
- The cursor is changed in response to the mouse moving out of the thumbnail.
-
mouseMoved(MouseEvent)
- No implementation.
-
mousePressed(MouseEvent)
- No implementation.
-
mouseReleased(MouseEvent)
- No implementation.
-
setScrollPosition(int, int)
- Scroll to position (x,y).
-
setScrollPosition(Point)
- Scroll to position (x,y).
-
update(Graphics)
- Update the display screen.
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
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
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
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
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
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
mouseMoved
public void mouseMoved(MouseEvent event)
- No implementation.
- Parameters:
- event - the mouse event.
- See Also:
- MouseMotionListener
mousePressed
public void mousePressed(MouseEvent event)
- No implementation.
- Parameters:
- event - the mouse event.
- See Also:
- MouseListener
mouseReleased
public void mouseReleased(MouseEvent event)
- No implementation.
- Parameters:
- event - the mouse event.
- See Also:
- MouseListener
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
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
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
update
public void update(Graphics g)
- Update the display screen.
Modified from the default action to eliminate screen flicker.
- Overrides:
- update in class Container