Class Scrollable


  extended by Object
      extended by Component
          extended by Scrollable

public class Scrollable
extends Component

This class contains exactly one child component and provides an ability to scroll it automatically when focus changes or programmatically.

Setting scroll step to zero using setScrollStep(int) will disable automatic viewport focusing and scrolling. In this case the viewport must be adjusted manually using setCurrentPosition(int, int).


Constructor Summary
Scrollable(Style style, Component child)
          Constructs a new scrollable region.
 
Method Summary
  int, int getCurrentPosition()
          Returns a a current position of view port.
  int, int getPosition()
          Returns a a target position of view port.
  int, int getTotalSize()
          Returns a dimension of contained component.
  int, int getViewSize()
          Returns a dimension of view port.
 void setCurrentPosition(int x, int y)
          Sets the current position of view port.
 void setPosition(int x, int y)
          Sets a current position of view port.
 void setScrollStep(int step)
          Sets scroll step size.
 
Methods inherited from class Component
add, appendText, clear, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scrollable

public Scrollable(Style style,
                  Component child)
Constructs a new scrollable region.

Parameters:
style - Style to use
child - Child component
Method Detail

getViewSize

public   int, int getViewSize()
Returns a dimension of view port.

Returns:
Tuple containing (int viewWidth, int viewHeight)

getTotalSize

public   int, int getTotalSize()
Returns a dimension of contained component.

Returns:
Tuple containing (int childWidth, int childHeight)

getCurrentPosition

public   int, int getCurrentPosition()
Returns a a current position of view port. Position is a coordinate of pixel on top left corner of this Scrollable that is part of child Component. Current position may differ from target position if there is animation in progress.

Returns:
Tuple containing (int xpos, int ypos)
Since:
3.0.0
See Also:
getPosition(), setPosition(int, int), setCurrentPosition(int, int)

getPosition

public   int, int getPosition()
Returns a a target position of view port. Position is a coordinate of pixel on top left corner of this Scrollable that is part of child Component.

Returns:
Tuple containing (int xpos, int ypos)
See Also:
getCurrentPosition(), setPosition(int, int), setCurrentPosition(int, int)

setPosition

public void setPosition(int x,
                        int y)
Sets a current position of view port. If the position changes the child component are animated to target position.

Parameters:
x - X coordinate of visible view port
y - Y coordinate of visible view port
See Also:
getPosition(), getCurrentPosition(), setCurrentPosition(int, int)

setCurrentPosition

public void setCurrentPosition(int x,
                               int y)
Sets the current position of view port. Unlike setPosition(int, int) this method does not perform any animation.

Parameters:
x - X coordinate of visible view port
y - Y coordinate of visible view port
Since:
3.0.0
See Also:
getPosition(), getCurrentPosition(), setPosition(int, int)

setScrollStep

public void setScrollStep(int step)

Sets scroll step size. The scale of step varies from 0 to 100, where 100 is a full height of this component, and 1 being 1% from height of this component. This step is used by automatic scrolling triggered by focus changes. Default scoll step is 50.

If the step is zero the scrollable will not attempt to maintain focused component visible, in which case it needs to be update to manually.

Parameters:
step - Step size, in percents