Changes

Jump to: navigation, search

Lab BlackBerry Example

991 bytes added, 22:12, 26 February 2011
4
-----------------
--------
 
'''Step 4.'''
 
Two screen objects must be built for the app. They will be instances of classes that extend the ''MainScreen'' class. The MainScreen provides default standard behavior for BlackBerry GUI applications.
 
The first screen besides the title and a ''RichTextField'' object will also implement the ''close()'' method.
The code will look like this in a new file called MyScreen.java
 
<source lang="java">
package mypackage;
 
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;
 
public final class MyScreen extends MainScreen {
public MyScreen() {
setTitle(new LabelField("FIRST",
LabelField.USE_ALL_WIDTH));
add(new RichTextField("Hello to FIRST!",
Field.NON_FOCUSABLE));
}
public void close() {
Dialog.alert("Close this app!");
super.close();
}
}
 
</source>

Navigation menu