Back | Tutorial Home | Next
Every new release of MIDP has new classes added to lcdui packages. MIDP 2.0 added revolutionary gaming API with whole new package javax.microedition.lcdui.game which was of great help to the game developers. Though MIDP 3.0 does not have any revolutionary add-ons in lcdui, it brings to table some usefull utilities Text related items, Animated Images and tabbed panes
Tabbed Pane
Tabbed Pane is a collection of screens organized as tabs. Each tab is associated to a separate screen. When the user selects a particular tab the respective screen is displayed.
Only following Screen subclasses can be added to the Tabbed Pane
Other Screen subclasses like TextBox, FileSelector, Canvas cannot be added to these Tabbed Panes. Also a TabbedPane cannot be added to another TabbedPane.
Create a Tabbed Pane using constructors
TabbedPane(java.lang.String title, boolean stringTab)
Parameter description
title: Title of the
screen
stringTab: true for string based tabs and false for image based tabs.
Add tabs using method
addTab(Screen tab, Image icon)
Parameter description
tab: Form and List
Screens
icon: If image based TabbedPane then this parameter is ignored
Suitable image width and height of the icon in Tabbed Pane can be found using following methods
Display.getBestImageWidth(Display.TAB)
Display.getBestImageHeight(Display.TAB)
Alternatively we can use
the following constructor for Image based tabbed pane.
TabbedPane(java.lang.String title, Screen[] tab, Image[] tabIcon, boolean suppresTitle)
title: Title of the
screen
tab: Array of Form and List Screen tabs that should be added to the Pane.
Image: Image Icon array
supressTitle: Setting this value to true changes the Tabbed Pane Screens
title to Tabs Title and False leaves the Screens title untouched.
TabbedPane class also supplies other usefull methods to change the TabbedPane and query the present state of TabbedPane
getCount(): Get number
of tabs.
getScreen(int index): Get handle to the index at the specified index.
getSelectedIndex(): get presently active screens index.
insertTab(int index, Screen tab, Image icon): Insert new
tab before the specified index.
removeTab(int index): remove tab from the specified index.
setFocus(int tabIndex): Set focus on the tab at the specified index.
There is no limit to number of tabs that can be added to the TabbedPane. If the number of tabs that can be displayed exceeds the screen width then navigation arrows come at the left and right corner of the screen
TabListener interface
This interface is used to track the change in tab navigation.
This listener can be registered
to TabbedPane using
TabbedPane.addTabListener(TabListener tabListener)
To catch the tab focus event on a particular tab use
tabChangeEvent(Screen tab)
Back
| Tutorial
Home | Next
More Tutorials
MIDP for Beginners
MIDP Gaming
JSR 179: Location Based Services
This page is a part of
a frames based web site. If you have landed on this page from a search engine
click here to view the complete page.