|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Container | +--waba.ui.TabPanel
TabPanel is a bar of tabs. (Very) Modified by Guich. The panels are created automaticaly and switched when the user press the corresponding tab. Makes an sound when the tab is pressed.
Here is an example showing a tab bar being used:
public class MyProgram extends MainWindow { TabPanel tab; public void onStart() { String nomes[] = {"Edition","Report"}; tab = new TabPanel(nomes); add(tab); tab.setGaps(2,2,2,2); // set it before setting the rect tab.setRect(getClientRect()); tab.setPanel(0,new Edition()); // replace container 1 by a class that extends Container. tab.getPanel(1).add(new Label("Not implemented"),CENTER,CENTER); add(tab); } public void onEvent(Event event) { if (event.type == ControlEvent.PRESSED && event.target == tp) { int activeIndex = tp.getActiveTab(); ... handle tab being pressed } } }
Field Summary | |
boolean |
beepOn
Set to off to disable the beep when a tab is clicked |
static byte |
TABS_BOTTOM
|
static byte |
TABS_TOP
|
Fields inherited from class waba.ui.Container |
BORDER_LOWERED,
BORDER_NONE,
BORDER_RAISED,
BORDER_SIMPLE,
children,
lastH,
lastW,
lastX,
lastY,
parentWindow,
tail |
Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
Constructor Summary | |
TabPanel(String[] tabCaptions)
Constructs a tab bar control. |
Method Summary | |
int |
getActiveTab()
Returns the index of the selected tab |
Color |
getCaptionColor()
Gets the text color of the captions. return a grayed value if this control is not enabled. |
Rect |
getClientRect()
Returns the area excluding the tabs and borders for this TabPanel. |
Container |
getPanel(int i)
Returns the Container for tab i |
int |
getPreferredHeight()
Returns the minimum height for this TabPanel |
int |
getPreferredWidth()
Returns the minimum width for this TabPanel |
protected void |
onBoundsChanged()
used internally. resizes all the containers. |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. |
void |
onEvent(Event event)
Called by the system to pass events to the tab bar control. |
void |
onPaint(Graphics g)
Called by the system to draw the tab bar. |
void |
setActiveTab(int tab)
Sets the currently active tab. |
void |
setBorderStyle(byte style)
Sets the type of border. see the waba.ui.Window xxx_BORDER constants. |
void |
setCaptionColor(Color capColor)
Sets the text color of the captions |
void |
setGaps(int gapL,
int gapR,
int gapT,
int gapB)
sets gaps between the containers and the TabPanel. |
void |
setPanel(int i,
Container container)
Sets this tabpanel container of index i to the given container. |
void |
setPanelsBackColor(Color[] backColors)
Sets the colors of the panels. |
void |
setType(byte type)
Sets the position of the tabs. use constants TAB_TOP or TAB_BOTTOM. |
Methods inherited from class waba.ui.Container |
add,
add,
add,
broadcastEvent,
findChild,
getChildren,
onStart,
paintChildren,
remove,
setEnabled |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
isVisible,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public boolean beepOn
public static final byte TABS_TOP
public static final byte TABS_BOTTOM
Constructor Detail |
public TabPanel(String[] tabCaptions)
Method Detail |
public void setPanelsBackColor(Color[] backColors)
public void setType(byte type)
public Container getPanel(int i)
public void setGaps(int gapL, int gapR, int gapT, int gapB)
setRect
public void setBorderStyle(byte style)
public void setPanel(int i, Container container)
public void setActiveTab(int tab)
public int getActiveTab()
public void onEvent(Event event)
event
- the event to processEvent
,
KeyEvent
,
PenEvent
public int getPreferredHeight()
public int getPreferredWidth()
protected void onBoundsChanged()
protected void onColorsChanged(boolean colorsChanged)
public void onPaint(Graphics g)
g
- the graphics object for drawingGraphics
public void setCaptionColor(Color capColor)
public Color getCaptionColor()
public Rect getClientRect()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |