Topic: Develop blackberry applications in java
The ui program of blackberry starts from the main function and needs to do three things in this main function.
1. Create a UiApplication object instance
2. Create a Screen object instance and add it to the Screen queue.
3. Place the UiApplication object instance created in step 1 to the event scheduling queue
Code:
| -- StatUiApplication. java
1 public class StartUiApplication extends UiApplication {
2 public static void main (String [] args ){
3
4 StartUiApplication s = new StartUiApplication (); // 1. Create a UiApplication object instance
5
6 UiApplication. getUiApplication (). pushScreen (new HelloScreen (); // 2. Create a Screen object instance and add it to the Screen queue.
7
8 s. enterEventDispatcher (); // 3. Put the UiApplication object instance created in step 1 to the event scheduling queue
9
10}
11}
Note: steps 2 and 3 cannot be reversed in the program process. If there is no Screen object in the program, the program will always "die" there, ignore the Screen after you call the enterEventDispatcher () method.
| -- HelloScreen. java
1 public class HelloScreen extends MainScreen {
2
3 public HelloScreen (){
4 super ();
5 setTitle (new LabelField ("hello ^ screen "));
6}
7}