|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.TabBar
public class TabBar
Manages and paints the tabs of a tabbed form (or another Screen).
Copyright (c) Enough Software 2005 - 2008
history
23-Jan-2005 - rob creation
| Field Summary | |
|---|---|
protected boolean |
handlePointerReleaseEvent
|
| Constructor Summary | |
|---|---|
TabBar(java.lang.String[] tabNames,
javax.microedition.lcdui.Image[] tabImages)
Creates a new tab bar. |
|
TabBar(java.lang.String[] tabNames,
javax.microedition.lcdui.Image[] tabImages,
Style style)
Creates a new tab bar. |
|
| Method Summary | |
|---|---|
void |
addNewTab(int index,
java.lang.String tabName,
javax.microedition.lcdui.Image tabImage)
Creates a new tab on the tab bar. |
void |
addNewTab(int index,
java.lang.String tabName,
javax.microedition.lcdui.Image tabImage,
Style tabStyle)
Creates a new tab on the tab bar. |
void |
addNewTab(java.lang.String tabName,
javax.microedition.lcdui.Image tabImage)
Creates a new tab on the tab bar. |
void |
addNewTab(java.lang.String tabName,
javax.microedition.lcdui.Image tabImage,
Style tabStyle)
Creates a new tab on the tab bar. |
protected java.lang.String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected void |
defocus(Style originalStyle)
Removes the focus from this item. |
protected Style |
focus(Style newStyle,
int direction)
Focuses this item. |
int |
getNextTab()
Retrieves the index of the currently selected tab. |
Item |
getTabItem(int tabIndex)
Retrieves a tab item |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
protected boolean |
handlePointerPressed(int x,
int y)
Handles the event when a pointer has been pressed at the specified position. |
protected boolean |
handlePointerReleased(int x,
int y)
Handles the event when a pointer has been released at the specified position. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
protected void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
void |
removeTab(int index)
Removes a tab from the tab bar. |
void |
setActiveTab(int index)
Changes the active/selected tab. |
void |
setImage(int tabIndex,
javax.microedition.lcdui.Image image)
Sets the image for the specified tab. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setTabItem(int tabIndex,
Item item)
Sets a tab item |
void |
setText(int tabIndex,
java.lang.String text)
Sets the text for the specified tab. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean handlePointerReleaseEvent
| Constructor Detail |
|---|
public TabBar(java.lang.String[] tabNames,
javax.microedition.lcdui.Image[] tabImages)
tabNames - the names of the tabstabImages - the images of the tabs, can be null
public TabBar(java.lang.String[] tabNames,
javax.microedition.lcdui.Image[] tabImages,
Style style)
tabNames - the names of the tabstabImages - the images of the tabs, can be nullstyle - the style of the bar| Method Detail |
|---|
public void setActiveTab(int index)
index - the index of the active tab, the first tab has the index 0.
protected Style focus(Style newStyle,
int direction)
Item
focus in class ItemnewStyle - the style which is used to indicate the focused statedirection - the direction from which this item is focused,
either Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT or 0.
When 0 is given, the direction is unknown.
protected void defocus(Style originalStyle)
Item
defocus in class ItemoriginalStyle - the original style which will be restored.
protected void initContent(int firstLineWidth,
int lineWidth)
Item
initContent in class ItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeight
protected void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Item
paintContent in class Itemx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.protected java.lang.String createCssSelector()
Item
createCssSelector in class Itempublic void setStyle(Style style)
Item
setStyle in class Itemstyle - the new style for this item.
protected boolean handleKeyPressed(int keyCode,
int gameAction)
Item
handleKeyPressed in class ItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handlePointerPressed(int x,
int y)
Item
handlePointerPressed in class Itemx - the x position of the pointer pressing relative to this item's left positiony - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
protected boolean handlePointerReleased(int x,
int y)
Item
handlePointerReleased in class Itemx - the x position of the pointer pressing relative to this item's left positiony - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
public void setImage(int tabIndex,
javax.microedition.lcdui.Image image)
tabIndex - the index of the tabimage - the image
public void setText(int tabIndex,
java.lang.String text)
tabIndex - the index of the tabtext - the textpublic int getNextTab()
public void addNewTab(java.lang.String tabName,
javax.microedition.lcdui.Image tabImage)
tabName - the name of the new tabtabImage - the image of the new tab, can be null
public void addNewTab(java.lang.String tabName,
javax.microedition.lcdui.Image tabImage,
Style tabStyle)
tabName - the name of the new tabtabImage - the image of the new tab, can be nulltabStyle - the style of the tab
public void addNewTab(int index,
java.lang.String tabName,
javax.microedition.lcdui.Image tabImage)
tabName - the name of the new tabtabImage - the image of the new tab, can be null
public void addNewTab(int index,
java.lang.String tabName,
javax.microedition.lcdui.Image tabImage,
Style tabStyle)
tabName - the name of the new tabtabImage - the image of the new tab, can be nulltabStyle - the style of the tabpublic void removeTab(int index)
index - the index of the tab to removepublic Item getTabItem(int tabIndex)
tabIndex - the index of the tab item
public void setTabItem(int tabIndex,
Item item)
tabIndex - the index of the tabitem - the item
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||