Blackberry JAVA DEVELOPMENT ENVIRONMENT Panduan Memulai - Halaman 14

Jelajahi secara online atau unduh pdf Panduan Memulai untuk Perangkat lunak Blackberry JAVA DEVELOPMENT ENVIRONMENT. Blackberry JAVA DEVELOPMENT ENVIRONMENT 32 halaman. Version 4.7.0
Juga untuk Blackberry JAVA DEVELOPMENT ENVIRONMENT: Catatan Rilis (8 halaman)

Getting started guide
3. In the constructor, add the following code:
super();
LabelField title = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS |
LabelField.USE_ALL_WIDTH);
setTitle(title);
add(new RichTextField("Hello World!"));

Allow the HelloWorld application display a screen

pushScreen()
The
method is inherited from the
and paints it. The BlackBerry® JVM maintains screens in a display stack. See
information.
HelloWorld
>
In the
//display a new screen
pushScreen(new HelloWorldScreen());
Display a message when a BlackBerry smartphone user closes the HelloWorld
application
The
onClose()
method is inherited from the
a close event has occurred.
The
Dialog.alert()
method creates an alert dialog box that a BlackBerry device application can use to notify a
BlackBerry smartphone user of an event or some important information. The dialog uses an exclamation mark
bitmap. See
Dialog
in the API Reference for more information.
>
In the HelloWorldScreen class, overide the onClose() method using the following code:
public boolean onClose()
{ Dialog.alert("Goodbye!");
System.exit(0);
return true;
}

Test the HelloWorld application in the BlackBerry Smartphone Simulator

1.
From the Run menu, click Run As > BlackBerry Simulator.
2. In the Choose a launch Configuration dialog box, select a launch configuration.
3. Press OK.
4. From the HomeScreen of the BlackBerry® Smartphone Simulator, select and open the HelloWorld . The
BlackBerry device application displays the text HelloWorld!.
5. From the FullMenu of the BlackBerry device application, select the Close menu item. The BlackBerry device
application displays a dialog with the text Goodbye!.
14
constructor, add the following code:
Screen
UiApplication
class and pushes a screen onto the display stack
class and indicates to an BlackBerry® device application that
Screen
in the API Reference for more