public class ScrollLayer extends Object implements ComponentListener
Constructor and Description |
---|
ScrollLayer(Camera cc)
Create all elements that compose the scroll bars to control a camera.
|
ScrollLayer(Camera cc,
Glyph[] widgets)
Create all elements that compose the scroll bars to control a camera.
|
Modifier and Type | Method and Description |
---|---|
void |
cameraUpdated()
Call this method whener the controlled camera's position / altitude changes.
|
void |
componentHidden(ComponentEvent e)
For internal use.
|
void |
componentMoved(ComponentEvent e)
For internal use.
|
void |
componentResized(ComponentEvent e)
For internal use.
|
void |
componentShown(ComponentEvent e)
For internal use.
|
boolean |
cursorInside(int cx,
int cy)
Tells whether the given point is inside the area containing the scroll bars or not.
|
void |
draggingHorizontalSlider(int dx)
Call this method when the horizontal slider is manipulated (e.g., dragged) through the user interface.
|
void |
draggingVerticalSlider(int dy)
Call this method when the vertical slider is manipulated (e.g., dragged) through the user interface.
|
void |
fade(AnimationManager am,
int duration,
float alphaOffset)
Make scroll bars fade in/out (gradually appear/disappear).
|
Camera |
getControlledCamera()
Get the camera controlled by the scroll bars.
|
Glyph |
getDownButton()
Get the glyph that represents the DOWN button.
|
Glyph |
getHorizontalSlider()
Get the glyph that represents the horizontal slider.
|
Glyph |
getLeftButton()
Get the glyph that represents the LEFT button.
|
Glyph |
getRightButton()
Get the glyph that represents the RIGHT button.
|
Glyph |
getUpButton()
Get the glyph that represents the UP button.
|
Glyph |
getVerticalSlider()
Get the glyph that represents the vertical slider.
|
Camera |
getWidgetCamera()
Get the internal camera managed by this ScrollLayer to display the scroll bar glyphs.
|
void |
moveDown()
Call this method when the DOWN button of the vertical scrollbar is actuated.
|
void |
moveLeft()
Call this method when the LEFT button of the horizontal scrollbar is actuated.
|
void |
moveRight()
Call this method when the RIGHT button of the horizontal scrollbar is actuated.
|
void |
moveUp()
Call this method when the UP button of the vertical scrollbar is actuated.
|
void |
setMinimumSliderSize(int s)
Set the minimum size of the sliders.
|
void |
setView(View v)
Set the view the controlled camera belongs to.
|
void |
updateHorizontalScrollBar()
Call this method directly if scroll bars should be updated for reasons other than changes to glyphs in the controlled camera's virtual space or changes to that camera itself.
|
void |
updateScrollBars()
Call this method directly if scroll bars should be updated for reasons other than changes to glyphs in the controlled camera's virtual space or changes to that camera itself.
|
void |
updateVerticalScrollBar()
Call this method directly if scroll bars should be updated for reasons other than changes to glyphs in the controlled camera's virtual space or changes to that camera itself.
|
void |
virtualSpaceUpdated()
Call this method whenever you add or remove objects from the virtual space containing the controlled camera.
|
public ScrollLayer(Camera cc)
cc
- camera that will be controlled by these scroll barspublic ScrollLayer(Camera cc, Glyph[] widgets)
cc
- camera that will be controlled by these scroll barswidgets
- list of widgets that should be used to represent the scrollbar components (if you want to customize their look and feel). The glyphs should not be added to any virtual space (this is taken care of internally). All glyphs should implement interface RectangularShape. Provide the glyphs in the following order: vertical scroll bar gutter, slider, up button, down button, horizontal scroll bar gutter, slider, left button, right button.public void setView(View v)
public void setMinimumSliderSize(int s)
s
- size in pixelspublic void virtualSpaceUpdated()
public void cameraUpdated()
public void updateScrollBars()
public void updateVerticalScrollBar()
public void updateHorizontalScrollBar()
public boolean cursorInside(int cx, int cy)
cx
- provide projected JPanel coordinates of the associated view, not virtual space coordinatescy
- provide projected JPanel coordinates of the associated view, not virtual space coordinatespublic Camera getWidgetCamera()
public Camera getControlledCamera()
public void draggingHorizontalSlider(int dx)
dx
- the horizontal translation that will be applied to the slider (negative values translate it left, positive values right)public void draggingVerticalSlider(int dy)
dy
- the vertical translation that will be applied to the slider (negative values translate it down, positive values up)public void moveUp()
public void moveDown()
public void moveLeft()
public void moveRight()
public Glyph getVerticalSlider()
public Glyph getHorizontalSlider()
public Glyph getUpButton()
public Glyph getDownButton()
public Glyph getLeftButton()
public Glyph getRightButton()
public void fade(AnimationManager am, int duration, float alphaOffset) throws ClassCastException
ClassCastException
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2015 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.