Package totalcross.ui
Class TabbedContainer
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.ClippedContainer
-
- totalcross.ui.TabbedContainer
-
- All Implemented Interfaces:
ControlAnimation.AnimationFinished,Scrollable
public class TabbedContainer extends ClippedContainer implements Scrollable, ControlAnimation.AnimationFinished
TabbedContainer is a bar of text or image tabs. It is assumed that all images will have the same height, but they may have different widths.
A scroll is automatically added when the total width of the titles is bigger than the control's width.
The containers are created automatically and switched when the user press the corresponding tab.Here is an example showing a tab bar being used:
public class MyProgram extends MainWindow { TabbedContainer tab; public void initUI() { String names[] = {"Edition","Report"}; tab = new TabbedContainer(names); add(tab); tab.setGaps(2,2,2,2); // set it before setting the rect tab.setRect(LEFT,TOP,FILL,FILL); tab.setContainer(0,new Edition()); // replace container 1 by a class that extends Container. tab.getContainer(1).add(new Label("Not implemented"),CENTER,CENTER); } public void onEvent(Event event) { if (event.type == ControlEvent.PRESSED && event.target == tp) { int activeIndex = tp.getActiveTab(); ... handle tab being pressed } } }Here's another sample that will show two TabbedContainers, one with images and another one with scrolling tabs. Note that you must create img1.png and img2.png.TabbedContainer tp1 = new TabbedContainer(new Image[]{new Image("img1.png"), new Image("img2.png")}, null); add(tp1); tp1.setRect(LEFT,TOP,Settings.screenWidth/2,Settings.screenHeight/2); tp1.activeTabBackColor = Color.getRGB(222,222,222); TabbedContainer tp2 = new TabbedContainer(new String[]{"verinha","marcelo","denise","guilherme","renato","michelle","rafael","barbara","lucas","ronaldo","nenem",}); add(tp2); tp2.setRect(LEFT,AFTER+2,FILL,FILL);When the user interface is Android, the tabs do not look good if the background is the same of the parent's. In this case, we force the background to be slighly darker. There are a few fields that you can use to change the color, like activeTabBackColor, useOnTabTheContainerColor and pressedColor. Important: starting in TotalCross 1.3, with Settings.fingerTouch=true, you CANNOT call setRect in your container. Otherwise, the flick and drag will not work and your container will be positioned incorrectly.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description intactiveTabBackColorThis color is the one used to paint the background of the active tab.static booleanallowFlickSet to false to disable flicking between tabs.booleanallSameWidthSet to true to make all tabs have the same width.intanimationTimeAnimation time when you click in the tab.intarrowsColorSet the arrows color right after the constructor and after calling setCaptionsColor, which also change this property.booleanautoShrinkCaptionsSet to true to automatically shrink the captions to prevent using arrows.intextraTabHeightDefine an extra height for the tabs.protected FlickflickThe Flick object listens and performs flick animations on PenUp events when appropriate.booleanflickIntoDisabledTabsIn finger touch devices, the user still can flick into a disabled tab.intlastActiveTabStores the last active tab index, or -1 if none was previously selected.intpressedColorSet the color when the user clicks on the tab.booleanshowArrowsEnables or not the arrows if scroll is needed.static byteTABS_BOTTOMTo be used on the setType method: specifies that the tabs will be placed on the bottom.static byteTABS_NONETo be used on the setType method: specifies that the tabs will be hidden and you will be responsible to change them.static byteTABS_TOPTo be used on the setType method: specifies that the tabs will be placed on the top.int[]tabsBackColorSets the colors used on each tab.intunselectedTextColorThe color used for the text of unselected tabs.booleanuseBorder2Set to true to enable the alternative tab borderbooleanuseOnTabTheContainerColorSets the tabs with the same colors of the container.-
Fields inherited from class totalcross.ui.ClippedContainer
bagClipX0, bagClipXf, bagClipY0, bagClipYf, lastMid, verticalOnly
-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, nextTabControl, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description TabbedContainer(java.lang.String[] strCaptions)Constructs a tab bar control with Strings as captions.TabbedContainer(Image[] imgCaptions)Constructs a tab bar control with images as captions, using the given color as transparent color.TabbedContainer(Image[] imgCaptions, int transparentColor)Constructor to keep compilation compatibility with TC 1; transparentColor is ignored.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanScrollContent(int direction, java.lang.Object target)Checks if there is room to flick this container in the given direction.voidchangeHighlighted(Container p, boolean forward)Tranfer the focus between the containers on this TabbedContainerprotected voidcomputeClipRect()voidcomputeTabsRect()compute the rects that represents each tab on the screen.voidflickEnded(boolean atPenDown)Called when the flick animation is ended.booleanflickStarted()Called when the flick animation is started.ContainergetActiveContainer()Returns the container of the active tab.intgetActiveTab()Returns the index of the selected tabintgetCaptionColor()Gets the text color of the captions.RectgetClientRect()Returns the area excluding the tabs and borders for this TabbedContainer.protected voidgetClientRect(Rect r)Returns the area excluding the tabs and borders for this TabbedContainer.ContainergetContainer(int i)Returns the Container for tab iintgetEffectH()intgetEffectW()intgetEffectX()intgetEffectY()FlickgetFlick()Returns the current flick object.voidgetFocusableControls(Vector v)Get a list of child controls of this container which are focus candidatesintgetPreferredHeight()Returns the caption height for this TabbedContainer.intgetPreferredWidth()Returns the minimum width (based on the sizes of the captions) for this TabbedContainerintgetScrollPosition(int direction)Returns the current position given the direction.intgetTabColor(int tab)Returns the color of the given tab.intgetTabCount()Returns the number of tabs.intgetType()Returns the tabs type.ControlhandleGeographicalFocusChangeKeys(KeyEvent ke)Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.voidinitUI()Called to initialize the User Interface of this container.booleanisAtTop()Deprecated.Use getTypebooleanisEnabled(int tabIndex)Returns if the given tab index is enabled.voidonAnimationFinished(ControlAnimation anim)protected voidonBoundsChanged(boolean screenChanged)Used internally.protected voidonColorsChanged(boolean colorsChanged)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonEvent(Event event)Called by the system to pass events to the tab bar control.voidonFontChanged()Compute the rectangles of the tabs based on the selected (bolded) and unselected (plain) titles.voidonPaint(Graphics g)Called by the system to draw the tab bar.voidreposition()Reposition this control, calling again setRect with the original parameters.voidresizeHeight()Resizes the height of each added container and sets the height of this TabbedContainer to the maximum height of the containers.booleanscrollContent(int xDelta, int yDelta, boolean fromFlick)Performs a relative move.voidsetActiveIcon(Image newActiveIcon)Sets the active icon.voidsetActiveTab(int tab)Sets the currently active tab, animating it.voidsetActiveTab(int tab, boolean animate)Sets the currently active tab.voidsetBorderStyle(byte style)Sets the type of border.voidsetCaptionColor(int capColor)Sets the text color of the captions in the tabs.voidsetCaptions(java.lang.String[] caps)Changes the tab captions.voidsetContainer(int i, Container container)Replaces the default created Container with the given one.voidsetEnabled(boolean b)Sets if this container and all childrens can or not accept eventsvoidsetEnabled(int tabIndex, boolean on)Sets the given tab index as enabled or not.voidsetHighlighting()Only return to highlighting when we wantvoidsetIcons(Image[] icons)Set the given icons to appear at the top (or bottom, if TABS_BOTTOM) of a text TabbedContainer.voidsetIcons(Image[] icons, Image activeIcon)Set the given icons to appear at the top (or bottom, if TABS_BOTTOM) of a text TabbedContainer.voidsetType(byte type)Sets the position of the tabs.booleanwasScrolled()Returns true if the control was scrolled since last pen down-
Methods inherited from class totalcross.ui.ClippedContainer
paintChildren
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, applyTransitionEffect, broadcastEvent, clear, fillBackground, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderStyle, getChildren, getChildrenCount, getFirstChild, getInsets, incLastX, incLastY, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onRemove, onSwapFinished, remove, removeAll, resize, resizeWidth, setFocusTraversable, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addTimer, addTimer, addTimerListener, addWindowListener, bringToFront, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, repositionChildren, requestFocus, resetSetPositions, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
arrowsColor
public int arrowsColor
Set the arrows color right after the constructor and after calling setCaptionsColor, which also change this property.
-
useBorder2
public boolean useBorder2
Set to true to enable the alternative tab border
-
autoShrinkCaptions
public boolean autoShrinkCaptions
Set to true to automatically shrink the captions to prevent using arrows. Works only for String-based captions.
-
showArrows
public boolean showArrows
Enables or not the arrows if scroll is needed.
-
activeTabBackColor
public int activeTabBackColor
This color is the one used to paint the background of the active tab. This is specially useful for image tabs.- Since:
- SuperWaba 5.64
- See Also:
Control.setBackColor(int),useOnTabTheContainerColor,tabsBackColor
-
tabsBackColor
public int[] tabsBackColor
Sets the colors used on each tab. You must create and set the array with the colors. Pass -1 to keep the original color. This array has precedence over the other ways that changes colors, except activeTabBackColor.- Since:
- TotalCross 1.52
- See Also:
Control.setBackColor(int),useOnTabTheContainerColor,activeTabBackColor
-
useOnTabTheContainerColor
public boolean useOnTabTheContainerColor
Sets the tabs with the same colors of the container.- Since:
- SuperWaba 5.72
- See Also:
Control.setBackColor(int),tabsBackColor,activeTabBackColor
-
lastActiveTab
public int lastActiveTab
Stores the last active tab index, or -1 if none was previously selected.- Since:
- SuperWaba 4.21
-
flickIntoDisabledTabs
public boolean flickIntoDisabledTabs
In finger touch devices, the user still can flick into a disabled tab. To disable this behaviour, set this flag to false; so when a disabled tab is reached, the user will not be able to flick into it, and will have to click on an enabled tab to continue flicking.- Since:
- TotalCross 1.3
-
TABS_TOP
public static final byte TABS_TOP
To be used on the setType method: specifies that the tabs will be placed on the top.- See Also:
- Constant Field Values
-
TABS_BOTTOM
public static final byte TABS_BOTTOM
To be used on the setType method: specifies that the tabs will be placed on the bottom.- See Also:
- Constant Field Values
-
TABS_NONE
public static final byte TABS_NONE
To be used on the setType method: specifies that the tabs will be hidden and you will be responsible to change them.- See Also:
- Constant Field Values
-
pressedColor
public int pressedColor
Set the color when the user clicks on the tab.- Since:
- TotalCross 1.3.4
-
allSameWidth
public boolean allSameWidth
Set to true to make all tabs have the same width.- Since:
- TotalCross 1.3.4
-
extraTabHeight
public int extraTabHeight
Define an extra height for the tabs. Use something line fmH/2. Required when setIcons is called.- Since:
- TotalCross 1.3.4
- See Also:
setIcons(Image[])
-
unselectedTextColor
public int unselectedTextColor
The color used for the text of unselected tabs. Defaults to the foreground color.
-
flick
protected Flick flick
The Flick object listens and performs flick animations on PenUp events when appropriate.
-
allowFlick
public static boolean allowFlick
Set to false to disable flicking between tabs. You can still switch between the tabs by clicking on them. Sample:TabbedContainer.allowFlick = false; TabbedContainer tc = new TabbedContainer(caps); TabbedContainer.allowFlick = true;
-
animationTime
public int animationTime
Animation time when you click in the tab. Set to 0 to disable animation.
-
-
Constructor Detail
-
TabbedContainer
public TabbedContainer(java.lang.String[] strCaptions)
Constructs a tab bar control with Strings as captions.
-
TabbedContainer
public TabbedContainer(Image[] imgCaptions, int transparentColor)
Constructor to keep compilation compatibility with TC 1; transparentColor is ignored.
-
TabbedContainer
public TabbedContainer(Image[] imgCaptions)
Constructs a tab bar control with images as captions, using the given color as transparent color. If you don't want to use transparent colors, just pass -1 to the color.
-
-
Method Detail
-
computeClipRect
protected void computeClipRect()
- Overrides:
computeClipRectin classClippedContainer
-
initUI
public void initUI()
Description copied from class:ContainerCalled to initialize the User Interface of this container. This differs from the onAddAgain method by that this method is called only once, at the first time the control is added to the parent. When the container is being setup, the initUI method is called; then, the onAddAgain is called every time the container is added again.
-
getTabCount
public int getTabCount()
Returns the number of tabs.- Since:
- TotalCross 1.15
-
setEnabled
public void setEnabled(int tabIndex, boolean on)Sets the given tab index as enabled or not. When a tab is disabled, it is displayed faded, and if the user clicks on it, nothing happens. However, you still can activate it by calling setActiveTab. If there are no tabs enabled, the current tab will be made active and the controls will also be enabled. So, if you plan to disable all tabs, better disable the TabbedContainer control instead.- Parameters:
on- If true, the tab is enabled, if false it is disabled.tabIndex- The tab's index (0 to count-1)- Since:
- TotalCross 1.01
- See Also:
setActiveTab(int)
-
isEnabled
public boolean isEnabled(int tabIndex)
Returns if the given tab index is enabled.- Since:
- TotalCross 1.01
-
setActiveIcon
public void setActiveIcon(Image newActiveIcon)
Sets the active icon.
-
setIcons
public void setIcons(Image[] icons)
Set the given icons to appear at the top (or bottom, if TABS_BOTTOM) of a text TabbedContainer. The icon images must be squared. You must also set the extraTabHeight, because the icons will be resized to (extraTabHeight-fmH) in both directions.- Since:
- TotalCross 1.3.4
-
setIcons
public void setIcons(Image[] icons, Image activeIcon)
Set the given icons to appear at the top (or bottom, if TABS_BOTTOM) of a text TabbedContainer. The icon images must be squared. You must also set the extraTabHeight, because the icons will be resized to (extraTabHeight-fmH) in both directions. Also, sets the active icon.
-
setType
public void setType(byte type)
Sets the position of the tabs. use constants TABS_TOP or TABS_BOTTOM. Since the tabs are not changed dinamicaly, this method must be called after the constructor.
-
getType
public int getType()
Returns the tabs type.
-
getContainer
public Container getContainer(int i)
Returns the Container for tab i
-
setBorderStyle
public void setBorderStyle(byte style)
Sets the type of border. Currently, only the Window.NO_BORDER and Window.RECT_BORDER are supported. NO_BORDER only draws the line under the tabs.- Overrides:
setBorderStylein classContainer- See Also:
Container.BORDER_NONE,Container.BORDER_LOWERED,Container.BORDER_RAISED,Container.BORDER_SIMPLE,Container.BORDER_TOP,Container.BORDER_ROUNDED
-
setContainer
public void setContainer(int i, Container container)Replaces the default created Container with the given one. This way you can avoid adding a container to a container and, as such, waste memory. Note that you must do this before the first setRect for this TabbedContainer; otherwise, you must explicitly call setRect again to update the added container bounds
-
setActiveTab
public void setActiveTab(int tab)
Sets the currently active tab, animating it. A PRESSED event will be posted to the given tab if it is not the currently active tab; then, the containers will be switched.
-
setActiveTab
public void setActiveTab(int tab, boolean animate)Sets the currently active tab. A PRESSED event will be posted to the given tab if it is not the currently active tab; then, the containers will be switched. The animation is optional and can also be defined with @see
-
onAnimationFinished
public void onAnimationFinished(ControlAnimation anim)
- Specified by:
onAnimationFinishedin interfaceControlAnimation.AnimationFinished
-
getActiveTab
public int getActiveTab()
Returns the index of the selected tab
-
getActiveContainer
public Container getActiveContainer()
Returns the container of the active tab.- Since:
- TotalCross 1.2
-
getPreferredHeight
public int getPreferredHeight()
Returns the caption height for this TabbedContainer. Note that it is not possible to compute the correct height of each container, since they will be added AFTER this TabbedContainer has their bounds set. So, you should actually use some other way to specify the bounds, like FILL or FIT; using PREFERRED in the height of setRect will make your application abort.- Overrides:
getPreferredHeightin classControl
-
getPreferredWidth
public int getPreferredWidth()
Returns the minimum width (based on the sizes of the captions) for this TabbedContainer- Overrides:
getPreferredWidthin classControl
-
onBoundsChanged
protected void onBoundsChanged(boolean screenChanged)
Used internally. resizes all the containers and add the arrows if scroll is needed.- Overrides:
onBoundsChangedin classControl- Parameters:
screenChanged- If the bounds were changed due to a screen change (rotation, collapse)
-
setEnabled
public void setEnabled(boolean b)
Description copied from class:ContainerSets if this container and all childrens can or not accept events- Overrides:
setEnabledin classContainer
-
computeTabsRect
public void computeTabsRect()
compute the rects that represents each tab on the screen.
-
onFontChanged
public void onFontChanged()
Compute the rectangles of the tabs based on the selected (bolded) and unselected (plain) titles.- Overrides:
onFontChangedin classControl
-
onColorsChanged
protected void onColorsChanged(boolean colorsChanged)
Description copied from class:ControlCalled after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled- Overrides:
onColorsChangedin classContainer
-
onPaint
public void onPaint(Graphics g)
Called by the system to draw the tab bar.
-
getEffectW
public int getEffectW()
- Overrides:
getEffectWin classControl
-
getEffectH
public int getEffectH()
- Overrides:
getEffectHin classControl
-
getEffectX
public int getEffectX()
- Overrides:
getEffectXin classControl
-
getEffectY
public int getEffectY()
- Overrides:
getEffectYin classControl
-
getTabColor
public int getTabColor(int tab)
Returns the color of the given tab.- Since:
- TotalCross 1.52
-
setCaptionColor
public void setCaptionColor(int capColor)
Sets the text color of the captions in the tabs.
-
getCaptionColor
public int getCaptionColor()
Gets the text color of the captions. return a grayed value if this control is not enabled.
-
getClientRect
public Rect getClientRect()
Returns the area excluding the tabs and borders for this TabbedContainer. Note: do not change the returning rect object !- Overrides:
getClientRectin classContainer- See Also:
Container.getClientRect(Rect)
-
getClientRect
protected void getClientRect(Rect r)
Returns the area excluding the tabs and borders for this TabbedContainer. In this version, you provide the created Rect to be filled with the coords.- Overrides:
getClientRectin classContainer
-
onEvent
public void onEvent(Event event)
Called by the system to pass events to the tab bar control.
-
changeHighlighted
public void changeHighlighted(Container p, boolean forward)
Tranfer the focus between the containers on this TabbedContainer- Overrides:
changeHighlightedin classControl
-
setHighlighting
public void setHighlighting()
Only return to highlighting when we want- Overrides:
setHighlightingin classContainer
-
reposition
public void reposition()
Description copied from class:ControlReposition this control, calling again setRect with the original parameters.- Overrides:
repositionin classControl
-
getFocusableControls
public void getFocusableControls(Vector v)
Description copied from class:ContainerGet a list of child controls of this container which are focus candidates- Overrides:
getFocusableControlsin classContainer- Parameters:
v- A vector into which to add the focus candidates.
-
handleGeographicalFocusChangeKeys
public Control handleGeographicalFocusChangeKeys(KeyEvent ke)
Description copied from class:ControlUsed by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.- Overrides:
handleGeographicalFocusChangeKeysin classControl- Parameters:
ke- The KeyEvent to be processed- Returns:
- The control that should get focus as a result of this KeyEvent. Null if this control did not handle the KeyEvent.
- See Also:
Settings.geographicalFocus
-
isAtTop
@Deprecated public boolean isAtTop()
Deprecated.Use getTypeReturns true of the type is set to TABS_TOP.
-
resizeHeight
public void resizeHeight()
Resizes the height of each added container and sets the height of this TabbedContainer to the maximum height of the containers.- Overrides:
resizeHeightin classContainer- See Also:
Container.resizeWidth(),Container.resize()
-
flickStarted
public boolean flickStarted()
Description copied from interface:ScrollableCalled when the flick animation is started.- Specified by:
flickStartedin interfaceScrollable
-
flickEnded
public void flickEnded(boolean atPenDown)
Description copied from interface:ScrollableCalled when the flick animation is ended.- Specified by:
flickEndedin interfaceScrollable- Parameters:
atPenDown- Flag indicating if the animation ended due to a pendown event.
-
canScrollContent
public boolean canScrollContent(int direction, java.lang.Object target)Description copied from interface:ScrollableChecks if there is room to flick this container in the given direction.- Specified by:
canScrollContentin interfaceScrollable- Parameters:
direction- The direction we want to flick given by one of the following constants:target- The target of the series of PEN events that triggered this flick attempt.- Returns:
- true if the container can flick in the indicated direction.
-
scrollContent
public boolean scrollContent(int xDelta, int yDelta, boolean fromFlick)Description copied from interface:ScrollablePerforms a relative move.- Specified by:
scrollContentin interfaceScrollable- Parameters:
xDelta- The relative amount of pixels to move in the X axis.yDelta- The relative amount of pixels to move in the Y axis.
-
getScrollPosition
public int getScrollPosition(int direction)
Description copied from interface:ScrollableReturns the current position given the direction. Used on page scrolls.- Specified by:
getScrollPositionin interfaceScrollable
-
getFlick
public Flick getFlick()
Description copied from interface:ScrollableReturns the current flick object.- Specified by:
getFlickin interfaceScrollable
-
wasScrolled
public boolean wasScrolled()
Description copied from interface:ScrollableReturns true if the control was scrolled since last pen down- Specified by:
wasScrolledin interfaceScrollable
-
setCaptions
public void setCaptions(java.lang.String[] caps)
Changes the tab captions. The new array must have the same length or an exception is thrown.
-
-