waba.ui
Class TabBar
java.lang.Object
|
+--waba.ui.Control
|
+--waba.ui.Container
|
+--waba.ui.TabBar
- public class TabBar
- extends Container
TabBar is a bar of tabs.
Here is an example showing a tab bar being used:
public class MyProgram extends MainWindow
{
Tab tabOne;
Tab tabTwo;
public void onStart()
{
TabBar tabBarar = new TabBar();
tabOne = new Tab("One");
tabBar.add(tabOne);
tabTwo = new Tab("Two");
tabBar.add(tabTwo);
tabBar.setRect(10, 10, 80, 30);
add(tabBar);
}
public void onEvent(Event event)
{
if (event.type == ControlEvent.PRESSED &&
event.target == tabOne)
{
... handle tab one being pressed
Fields inherited from class waba.ui.Control |
BOTTOM,
CENTER,
controlCount,
enabled,
FILL,
fm,
font,
height,
LEFT,
name,
next,
parent,
PREFERRED,
prev,
RIGHT,
TOP,
width,
x,
y |
Constructor Summary |
TabBar()
Constructs a tab bar control. |
Method Summary |
void |
add(Control control)
Adds a tab to the tab bar. |
int |
getPreferredHeight()
returns the preffered height of this control. added by guich |
int |
getPreferredWidth()
returns the preffered width of this control. added by guich |
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(Tab tab)
Sets the currently active tab. |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getFontMetrics,
getNext,
getParent,
getRect,
isEnabled,
isVisible,
onBoundsChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
setEnabled,
setFont,
setRect,
setRect,
setVisible |
Methods inherited from class java.lang.Object |
hashCode,
toString |
TabBar
public TabBar()
- Constructs a tab bar control.
add
public void add(Control control)
- Adds a tab to the tab bar.
- Overrides:
- add in class Container
getPreferredWidth
public int getPreferredWidth()
- returns the preffered width of this control. added by guich
- Overrides:
- getPreferredWidth in class Control
getPreferredHeight
public int getPreferredHeight()
- returns the preffered height of this control. added by guich
- Overrides:
- getPreferredHeight in class Control
setActiveTab
public void setActiveTab(Tab tab)
- Sets the currently active tab. A PRESSED event will be posted to
the given tab if it is not the currently active tab.
onEvent
public void onEvent(Event event)
- Called by the system to pass events to the tab bar control.
- Overrides:
- onEvent in class Control
- Tags copied from class: Control
- Parameters:
event
- the event to process- See Also:
Event
,
KeyEvent
,
PenEvent
onPaint
public void onPaint(Graphics g)
- Called by the system to draw the tab bar.
- Overrides:
- onPaint in class Control
- Tags copied from class: Control
- Parameters:
g
- the graphics object for drawing- See Also:
Graphics