|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.Component com.sun.lwuit.Container com.sun.lwuit.Tabs
public class Tabs
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.
Field Summary |
---|
Fields inherited from class com.sun.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Constructor Summary | |
---|---|
Tabs()
Creates an empty TabbedPane with a default
tab placement of Component.TOP . |
|
Tabs(int tabPlacement)
Creates an empty TabbedPane with the specified tab placement
of either: Component.TOP , Component.BOTTOM ,
Component.LEFT , or Component.RIGHT . |
Method Summary | |
---|---|
void |
addTab(Button tab,
Component component)
Adds a component
represented by a button . |
void |
addTab(java.lang.String title,
Component component)
Adds a component
represented by a title and no icon . |
void |
addTab(java.lang.String title,
Image icon,
Component component)
Adds a component
represented by a title and/or icon ,
either of which can be null . |
void |
addTabsFocusListener(FocusListener listener)
Adds a focus listener to the tabs buttons |
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false. |
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 |
java.lang.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 |
java.lang.Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details). |
java.lang.Object |
getPropertyValue(java.lang.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 . |
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 |
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 |
java.lang.String |
getTabTitle(int index)
Returns the title of the tab at the given index |
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 |
void |
insertTab(Button tab,
Component component,
int index)
Inserts a component , at index ,
represented by a button
Uses java.util.Vector internally, see insertElementAt
for details of insertion conventions. |
void |
insertTab(java.lang.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 |
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 |
isSwipeActivated()
Returns true if the swipe between tabs is activated, this is relevant for touch devices only |
void |
refreshTheme()
Makes sure the component is up to date with the current style object |
void |
removeTabAt(int index)
Removes the tab at index . |
void |
removeTabsFocusListener(FocusListener listener)
Removes a foucs Listener from the tabs buttons |
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 |
java.lang.String |
setPropertyValue(java.lang.String name,
java.lang.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 |
setSwipeActivated(boolean swipeActivated)
Setter method for swipe mode |
void |
setTabPlacement(int tabPlacement)
Sets the tab placement for this tabbedpane. |
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 |
void |
setTabTitle(java.lang.String title,
Image icon,
int index)
Updates the information about the tab details |
void |
showTabs()
Show the tabs bar if it was hidden |
java.lang.String |
toString()
Overriden to return a useful value for debugging purposes |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tabs()
TabbedPane
with a default
tab placement of Component.TOP
.
public Tabs(int tabPlacement)
TabbedPane
with the specified tab placement
of either: Component.TOP
, Component.BOTTOM
,
Component.LEFT
, or Component.RIGHT
.
tabPlacement
- the placement for the tabs relative to the contentMethod Detail |
---|
public void refreshTheme()
Component
refreshTheme
in class Container
protected void deinitialize()
Component
deinitialize
in class Component
protected void initComponent()
Component
initComponent
in class Component
public boolean animate()
Animation
Display
class.
animate
in interface Animation
animate
in class Component
public void setTabTextPosition(int textPosition)
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)Component.LEFT
,
Component.RIGHT
,
Component.BOTTOM
,
Component.TOP
public 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(java.lang.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.sun.lwuit.Image, com.sun.lwuit.Component, int)
,
removeTabAt(int)
public void addTab(java.lang.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.sun.lwuit.Image, com.sun.lwuit.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.sun.lwuit.Image, com.sun.lwuit.Component, int)
,
removeTabAt(int)
public void insertTab(java.lang.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.sun.lwuit.Image, com.sun.lwuit.Component)
,
removeTabAt(int)
public void insertTab(Button 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.sun.lwuit.Image, com.sun.lwuit.Component)
,
removeTabAt(int)
public void setTabTitle(java.lang.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 tabpublic java.lang.String getTabTitle(int index)
index
- index for the tab
public Image getTabIcon(int index)
index
- index for the tab
public Image getTabSelectedIcon(int index)
index
- index for the tab
public void setTabSelectedIcon(int index, Image icon)
index
- index for the tabicon
- of the tab at the given indexpublic 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 removed
java.lang.IndexOutOfBoundsException
- if index is out of range
(index < 0 || index >= tab count)addTab(java.lang.String, com.sun.lwuit.Image, com.sun.lwuit.Component)
,
insertTab(java.lang.String, com.sun.lwuit.Image, com.sun.lwuit.Component, int)
public Component getTabComponentAt(int index)
index
.
index
- the index of the tab to be removed
java.lang.IndexOutOfBoundsException
- if index is out of range
(index < 0 || index >= tab count)addTab(java.lang.String, com.sun.lwuit.Image, com.sun.lwuit.Component)
,
insertTab(java.lang.String, com.sun.lwuit.Image, com.sun.lwuit.Component, int)
public int indexOfComponent(Component component)
component
- the component for the tab
public int getTabCount()
tabbedpane
.
public int getSelectedIndex()
public Component getSelectedComponent()
public void addTabsFocusListener(FocusListener listener)
listener
- FocusListenerpublic void removeTabsFocusListener(FocusListener listener)
listener
- FocusListenerpublic java.lang.String toString()
Component
toString
in class Component
public int getTabPlacement()
setTabPlacement(int)
public Container getContentPane()
public Container getTabsContainer()
public void setSelectedIndex(int index)
index
- the index to be selected
java.lang.IndexOutOfBoundsException
- 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 java.lang.String[] getPropertyNames()
Component
getPropertyNames
in class Component
public java.lang.Class[] getPropertyTypes()
Component
getPropertyTypes
in class Component
public java.lang.Object getPropertyValue(java.lang.String name)
Component
getPropertyValue
in class Component
name
- the name of the property
public java.lang.String setPropertyValue(java.lang.String name, java.lang.Object value)
Component
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the property
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |