public class Tabs extends Container
A component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon.
Tabs/components are added to a Tabs
object by using the
addTab
and insertTab
methods.
A tab is represented by an index corresponding
to the position it was added in, where the first tab has an index equal to 0
and the last tab has an index equal to the tab count minus 1.
The Tabs
uses a SingleSelectionModel
to represent the set of tab indices and the currently selected index.
If the tab count is greater than 0, then there will always be a selected
index, which by default will be initialized to the first tab.
If the tab count is 0, then the selected index will be -1.
A simple Tabs
sample looks a bit like this:
Tabs
allows swiping on the X-axis (by default) but also on the Y-axis (demo video):
A common use case for Tabs
is the iOS carousel UI where dots are drawn at the bottom of the
form and swiping is used to move between pages:
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
Tabs()
Creates an empty
TabbedPane with a default
tab placement of Component.TOP . |
Tabs(int tabP)
Creates an empty
TabbedPane with the specified tab placement
of either: Component.TOP , Component.BOTTOM ,
Component.LEFT , or Component.RIGHT . |
Modifier and Type | Method and Description |
---|---|
void |
addSelectionListener(SelectionListener listener)
Adds a selection listener to the tabs.
|
void |
addTab(Button tab,
Component component)
Deprecated.
should use radio button as an argument
|
Tabs |
addTab(String title,
char materialIcon,
float iconSize,
Component component)
Adds a
component
represented by a title and/or icon ,
either of which can be null . |
Tabs |
addTab(String title,
char icon,
Font font,
float iconSize,
Component component)
Adds a
component
represented by a title and/or icon ,
either of which can be null . |
void |
addTab(String title,
Component component)
Adds a
component
represented by a title and no icon . |
void |
addTab(String title,
Image icon,
Component component)
Adds a
component
represented by a title and/or icon ,
either of which can be null . |
Tabs |
addTab(String title,
Image icon,
Image pressedIcon,
Component component)
Adds a
component
represented by a title and/or icon ,
either of which can be null . |
void |
addTabsFocusListener(FocusListener listener)
Deprecated.
use addSelectionListener instead
|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
protected void |
bindTabActionListener(Component tab,
ActionListener l)
Binds an action listener to the tab component.
|
protected Component |
createTab(String title,
Font font,
char icon,
float size)
Creates a tab component by default this is a RadioButton but subclasses can use this to return anything
|
protected Component |
createTab(String title,
Image icon)
Creates a tab component by default this is a RadioButton but subclasses can use this to return anything
|
protected Motion |
createTabSlideMotion(int start,
int end)
Allows developers to customize the motion object for the slide effect
to provide a linear slide effect.
|
protected void |
deinitialize()
Invoked to indicate that the component initialization is being reversed
since the component was detached from the container hierarchy.
|
Container |
getContentPane()
This method retrieves the Tabs content pane
|
String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
String[] |
getPropertyTypeNames()
This method is here to workaround an XMLVM array type bug where property types aren't
identified properly, it returns the names of the types using the following type names:
String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
|
Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder
|
Component |
getSelectedComponent()
Returns the component associated with the tab at the given index
|
int |
getSelectedIndex()
Returns the currently selected index for this tabbedpane.
|
Component |
getTabComponentAt(int index)
Returns the tab at
index . |
int |
getTabCount()
Returns the number of tabs in this
tabbedpane . |
protected Image |
getTabIcon(Component tab)
Returns the icon of the tab component.
|
Image |
getTabIcon(int index)
Returns the icon of the tab at the given index
|
int |
getTabPlacement()
Returns the placement of the tabs for this tabbedpane.
|
Container |
getTabsContainer()
This method retrieves the Tabs buttons Container
|
protected Image |
getTabSelectedIcon(Component tab)
Returns the selected icon of the tab component.
|
Image |
getTabSelectedIcon(int index)
Returns the icon of the tab at the given index
|
int |
getTabTextPosition()
Returns The position of the text relative to the icon
|
protected String |
getTabTitle(Component tab)
Returns the title of the tab component.
|
String |
getTabTitle(int index)
Returns the title of the tab at the given index
|
String |
getTabUIID()
The UIID for a tab component which defaults to Tab
|
void |
hideTabs()
Hide the tabs bar
|
int |
indexOfComponent(Component component)
Returns the index of the tab for the specified component.
|
protected void |
initComponent()
Allows subclasses to bind functionality that relies on fully initialized and
"ready for action" component state
|
protected void |
initLaf(UIManager manager)
This method initializes the Component defaults constants
|
void |
insertTab(Component tab,
Component component,
int index)
Deprecated.
should use radio button as an argument
|
void |
insertTab(String title,
char icon,
Font font,
float iconSize,
Component component,
int index)
Inserts a
component , at index ,
represented by a title and/or icon ,
either of which may be null . |
void |
insertTab(String title,
Image icon,
Component component,
int index)
Inserts a
component , at index ,
represented by a title and/or icon ,
either of which may be null . |
boolean |
isAnimateTabSelection()
Indicates whether clicking on a tab button should result in an animation to the selected tab or an immediate switch
|
boolean |
isChangeTabContainerStyleOnFocus()
Indicates that the tabs container should have its style changed to the selected style when one of the tabs has focus
this allows incorporating it into the theme of the application
|
boolean |
isChangeTabOnFocus()
Indicates that a tab should change when the focus changes without the user physically pressing a button
|
boolean |
isEagerSwipeMode()
Allows marking tabs as swipe "eager" which instantly triggers swipe on movement
rather than threshold the swipe.
|
boolean |
isSwipeActivated()
Returns true if the swipe between tabs is activated, this is relevant for
touch devices only
|
boolean |
isSwipeOnXAxis()
Returns
true if the swipe is on the X-Axis, false if the swipe is on the Y-Axis. |
void |
refreshTheme(boolean merge)
Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!
|
void |
removeSelectionListener(SelectionListener listener)
Removes a selection Listener from the tabs
|
void |
removeTabAt(int index)
Removes the tab at
index . |
void |
removeTabsFocusListener(FocusListener listener)
Deprecated.
use addSelectionListener instead
|
protected void |
selectTab(Component tab)
Invoked to select a specific tab, this method should be overriden for subclasses overriding createTab
|
void |
setAnimateTabSelection(boolean animateTabSelection)
Indicates whether clicking on a tab button should result in an animation to the selected tab or an immediate switch
|
void |
setChangeTabContainerStyleOnFocus(boolean changeTabContainerStyleOnFocus)
Indicates that the tabs container should have its style changed to the selected style when one of the tabs has focus
this allows incorporating it into the theme of the application
|
void |
setChangeTabOnFocus(boolean changeTabOnFocus)
Indicates that a tab should change when the focus changes without the user physically pressing a button
|
void |
setEagerSwipeMode(boolean eagerSwipeMode)
Allows marking tabs as swipe "eager" which instantly triggers swipe on movement
rather than threshold the swipe.
|
String |
setPropertyValue(String name,
Object value)
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
void |
setSelectedIndex(int index)
Sets the selected index for this tabbedpane.
|
void |
setSelectedIndex(int index,
boolean slideToSelected)
Sets the currently selected index in the tabs component
|
void |
setSwipeActivated(boolean swipeActivated)
Setter method for swipe mode
|
void |
setSwipeOnXAxis(boolean b)
It defaults to
true ; you can set it to false for use cases like the
one discussed here:
Realize
a set of Containers that are browsable with a finger, like a deck of
cards |
void |
setTabPlacement(int tabPlacement)
Sets the tab placement for this tabbedpane.
|
void |
setTabsContentGap(int tabsGap)
This method allows setting the Tabs content pane spacing (right and left),
This can be used to create an effect where the selected tab is smaller
and the right and left tabs are visible on the sides
|
protected void |
setTabSelectedIcon(Component tab,
Image icon)
Sets the selected icon of the tab.
|
void |
setTabSelectedIcon(int index,
Image icon)
Sets the selected icon of the tab at the given index
|
void |
setTabTextPosition(int textPosition)
Sets the position of the text relative to the icon if exists
|
protected void |
setTabTitle(Component tab,
String title,
Image icon)
Updates the tabs title .
|
void |
setTabTitle(String title,
Image icon,
int index)
Updates the information about the tab details
|
void |
setTabUIID(String tabUIID)
The UIID for a tab button which defaults to Tab.
|
protected void |
setTextPosition(Component tabComponent,
int textPosition)
Invokes set text position on the given tab, the tab should be a toggle button radio by default but
can be anything
|
protected boolean |
shouldBlockSideSwipe()
A component that might need side swipe such as the slider
could block it from being used for some other purpose when
on top of said component.
|
void |
showTabs()
Show the tabs bar if it was hidden
|
String |
toString()
Overriden to return a useful value for debugging purposes
|
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintBackground, paintBorderBackground, paintComponentBackground, paintGlass, paramString, pointerPressed, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, unbindProperty, updateNativeOverlay, visibleBoundsContains
public Tabs()
TabbedPane
with a default
tab placement of Component.TOP
.public Tabs(int tabP)
TabbedPane
with the specified tab placement
of either: Component.TOP
, Component.BOTTOM
,
Component.LEFT
, or Component.RIGHT
.tabP
- the placement for the tabs relative to the contentprotected boolean shouldBlockSideSwipe()
Component
shouldBlockSideSwipe
in class Component
protected void initLaf(UIManager manager)
public void refreshTheme(boolean merge)
refreshTheme
in class Container
merge
- indicates if the current styles should be merged with the new stylesprotected void deinitialize()
deinitialize
in class Component
protected void initComponent()
initComponent
in class Component
public boolean animate()
Display
class.public void setTabTextPosition(int textPosition)
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
protected void setTextPosition(Component tabComponent, int textPosition)
tabComponent
- the component representing the tabtextPosition
- the text positionpublic int getTabTextPosition()
Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public void setTabPlacement(int tabPlacement)
Component.TOP
Component.BOTTOM
Component.LEFT
Component.RIGHT
Component.TOP
.tabPlacement
- the placement for the tabs relative to the contentpublic void addTab(String title, Image icon, Component component)
component
represented by a title
and/or icon
,
either of which can be null
.
Cover method for insertTab
.title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabcomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
public Tabs addTab(String title, Image icon, Image pressedIcon, Component component)
component
represented by a title
and/or icon
,
either of which can be null
.
Cover method for insertTab
.title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabpressedIcon
- the icon shown when the tab is selectedcomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
public Tabs addTab(String title, char materialIcon, float iconSize, Component component)
component
represented by a title
and/or icon
,
either of which can be null
.
Cover method for insertTab
.title
- the title to be displayed in this tabmaterialIcon
- one of the material design icon constants from FontImage
iconSize
- icon size in millimeterscomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
public Tabs addTab(String title, char icon, Font font, float iconSize, Component component)
component
represented by a title
and/or icon
,
either of which can be null
.
Cover method for insertTab
.title
- the title to be displayed in this tabicon
- an icon from the fontfont
- the font for the iconiconSize
- icon size in millimeterscomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
public void addTab(String title, Component component)
component
represented by a title
and no icon
.
Cover method for insertTab
.title
- the title to be displayed in this tabcomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
public void addTab(Button tab, Component component)
component
represented by a button
.
Cover method for insertTab
.
The Button styling will be associated with "Tab" UIID.tab
- represents the tab on topcomponent
- the component to be displayed when this tab is clickedinsertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
,
removeTabAt(int)
protected Component createTab(String title, Font font, char icon, float size)
title
- the title of the tabicon
- an icon from the fontfont
- the font for the iconprotected Component createTab(String title, Image icon)
title
- the title of the tabicon
- the icon of the tabpublic void insertTab(String title, Image icon, Component component, int index)
component
, at index
,
represented by a title
and/or icon
,
either of which may be null
.
Uses java.util.Vector internally, see insertElementAt
for details of insertion conventions.title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabcomponent
- The component to be displayed when this tab is clicked.index
- the position to insert this new tabaddTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component)
,
removeTabAt(int)
public void insertTab(String title, char icon, Font font, float iconSize, Component component, int index)
component
, at index
,
represented by a title
and/or icon
,
either of which may be null
.
Uses java.util.Vector internally, see insertElementAt
for details of insertion conventions.title
- the title to be displayed in this tabicon
- an icon from the fontfont
- the font for the iconcomponent
- The component to be displayed when this tab is clicked.index
- the position to insert this new tabaddTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component)
,
removeTabAt(int)
public void insertTab(Component tab, Component component, int index)
component
, at index
,
represented by a button
Uses java.util.Vector internally, see insertElementAt
for details of insertion conventions.
The Button styling will be associated with "Tab" UIID.tab
- represents the tab on topcomponent
- The component to be displayed when this tab is clicked.index
- the position to insert this new tabaddTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component)
,
removeTabAt(int)
protected void bindTabActionListener(Component tab, ActionListener l)
tab
- the tab componentl
- the listenerpublic void setTabTitle(String title, Image icon, int index)
title
- the title to be displayed in this tabicon
- the icon to be displayed in this tabindex
- the position to insert this new tabprotected void setTabTitle(Component tab, String title, Image icon)
tab
- the tab componenttitle
- the titleicon
- the new iconpublic String getTabTitle(int index)
index
- index for the tabprotected String getTabTitle(Component tab)
tab
- the tab componentprotected Image getTabIcon(Component tab)
tab
- the tab componentpublic Image getTabIcon(int index)
index
- index for the tabprotected Image getTabSelectedIcon(Component tab)
tab
- the tab componentpublic Image getTabSelectedIcon(int index)
index
- index for the tabpublic void setTabSelectedIcon(int index, Image icon)
index
- index for the tabicon
- of the tab at the given indexprotected void setTabSelectedIcon(Component tab, Image icon)
tab
- the tab componenticon
- of the tabpublic void removeTabAt(int index)
index
.
After the component associated with index
is removed,
its visibility is reset to true to ensure it will be visible
if added to other containers.index
- the index of the tab to be removedIndexOutOfBoundsException
- if index is out of range
(index < 0 || index >= tab count)addTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component)
,
insertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
public Component getTabComponentAt(int index)
index
.index
- the index of the tab to be removedIndexOutOfBoundsException
- if index is out of range
(index < 0 || index >= tab count)addTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component)
,
insertTab(java.lang.String, com.codename1.ui.Image, com.codename1.ui.Component, int)
public int indexOfComponent(Component component)
component
- the component for the tabpublic int getTabCount()
tabbedpane
.public int getSelectedIndex()
public Component getSelectedComponent()
public void addTabsFocusListener(FocusListener listener)
listener
- FocusListenerpublic void removeTabsFocusListener(FocusListener listener)
listener
- FocusListenerpublic void addSelectionListener(SelectionListener listener)
listener
- SelectionListenerpublic void removeSelectionListener(SelectionListener listener)
listener
- SelectionListenerpublic String toString()
public int getTabPlacement()
setTabPlacement(int)
public Container getContentPane()
public Container getTabsContainer()
public void setSelectedIndex(int index, boolean slideToSelected)
index
- the index for the tab starting with tab 0.slideToSelected
- true to animate the transition to the new selection
false to just move immediatelyprotected void selectTab(Component tab)
tab
- the tabpublic void setSelectedIndex(int index)
index
- the index to be selectedIndexOutOfBoundsException
- if index is out of range
(index < 0 || index >= tab count)public void hideTabs()
public void showTabs()
public boolean isSwipeActivated()
public void setSwipeActivated(boolean swipeActivated)
swipeActivated
- public boolean isChangeTabOnFocus()
public void setChangeTabOnFocus(boolean changeTabOnFocus)
changeTabOnFocus
- the changeTabOnFocus to setpublic boolean isChangeTabContainerStyleOnFocus()
public void setChangeTabContainerStyleOnFocus(boolean changeTabContainerStyleOnFocus)
changeTabContainerStyleOnFocus
- the changeTabContainerStyleOnFocus to setpublic void setTabsContentGap(int tabsGap)
tabsGap
- the gap on the sides of the content in pixels, the value must
be positive.public String getTabUIID()
public void setTabUIID(String tabUIID)
The UIID for a tab button which defaults to Tab.
Tab buttons used to have two separate styles for selected and unselected. This was later consolidated so
the tabs behave as a single toggle button (radio button) however one thing that remained is a call to
setUIID
that is implicitly made to restore the original "Tab" style.
Effectively Tabs invokes the setUIID
call on the Tab switch so if you want to manipulate
the tab UIID manually (have one red and one green tab) this is a problem.>.
To enable such code add all the tabs then just just invoke setTabUIID(null)
to disable
this behavior.
tabUIID
- the tabUIID to setpublic boolean isEagerSwipeMode()
public void setEagerSwipeMode(boolean eagerSwipeMode)
eagerSwipeMode
- the eagerSwipeMode to setpublic boolean isAnimateTabSelection()
public void setAnimateTabSelection(boolean animateTabSelection)
animateTabSelection
- the animateTabSelection to setprotected Motion createTabSlideMotion(int start, int end)
tabsSlideSpeedInt
theme constant to define the time in milliseconds between releasing the swiped
tab and reaching the next tab. This currently defaults to 200.start
- start positionend
- end position for the motionpublic void setSwipeOnXAxis(boolean b)
It defaults to true
; you can set it to false
for use cases like the
one discussed here:
Realize
a set of Containers that are browsable with a finger, like a deck of
cards
b
- true
to set the swipe on the X-Axis, false
to set the swipe on the Y-Axispublic boolean isSwipeOnXAxis()
true
if the swipe is on the X-Axis, false
if the swipe is on the Y-Axis.public String[] getPropertyNames()
getPropertyNames
in class Component
public Class[] getPropertyTypes()
getPropertyTypes
in class Component
public String[] getPropertyTypeNames()
getPropertyTypeNames
in class Component
public Object getPropertyValue(String name)
getPropertyValue
in class Component
name
- the name of the propertypublic String setPropertyValue(String name, Object value)
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the property