Blackberry JAVA DEVELOPMENT ENVIRONMENT Руководство по началу работы - Страница 13
Просмотреть онлайн или скачать pdf Руководство по началу работы для Программное обеспечение Blackberry JAVA DEVELOPMENT ENVIRONMENT. Blackberry JAVA DEVELOPMENT ENVIRONMENT 32 страницы. Version 4.7.0
Также для Blackberry JAVA DEVELOPMENT ENVIRONMENT: Примечание к выпуску (8 страниц)
For a BlackBerry device applicaion to provide a UI, the BlackBerry device application must extend the
net.rim.device.api.ui.UiApplication
to register event listeners, manage threads, and manage UI components.
A UI maintains a stack of
screens already on the stack. When a BlackBerry device application pops a screen off the stack, it redraws the
underlying screens as necessary. Only the screen on the top of the stack receives input events.
See
UiApplication
in the API Reference for more information.
1.
Create a main method for the BlackBerry device application. When you start a BlackBerry device application,
program exectution starts at the
public static void main(String[] args){
}
main()
2. Within the
method, add the following code:
HelloWorld theApp = new HelloWorld();
theApp.enterEventDispatcher();
When you invoke the
application, the BlackBerry device application enters the event thread which runs all drawing and event-
handling code and waits for events on the BlackBerry device application queue.
Create a screen for the HelloWorld application
super()
Invoking
invokes the constructor of the
class provides a UI screen that contains a title section, a separator element, and a single vertical field manager for
maintaining a list of fields. See
LabelField
A
lets a BlackBerry® device application display a label on a UI. See
for more information.
RichTextField
A
is a read-only text field you can use to show text in a variety of fonts and formats on a screen.
See
RichTextField
in the API Reference for more information.
Invoking
add(RichTextField("Hello World!"))
HelloWorldScreen
screen. See
1.
Create a class that extends the
final class HelloWorldScreen extends MainScreen {
2. Create a constructor for the
public HelloWorldScreen(){
}
class. This class provides methods for BlackBerry device applications
Screen
objects. As it pushes screens onto the stack, it draws them on top of any other
main()
method.
enterEventDispatcher()
HelloWorldScreen
MainScreen
in the API Reference for more information.
Manager
in the API Reference for more information.
MainScreen
class.
HelloWorldScreen
2: Create a basic BlackBerry device application
method using an instance of the BlackBerry device
superclass,
adds the
RichTextField
class.
MainScreen
MainScreen
. The
LabelField
in the API Reference
to the
Manager
object of the
13