Hello Screen

BY IN Blackberry Comments Off on Hello Screen

package hello;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

/**
* Application class.
*/
public class helloworld extends UiApplication
{
// Fungsi yang akan dipanggil pertama kali begitu aplikasi dijalankan.
// Wajib ada pada 1 aplikasi, maksimal 1, minimal 1.
public static void main(String[] args) {
// Membuat instance aplikasi dan masuk ke Event Thread
helloworld application = new helloworld();
application.enterEventDispatcher();
}

public helloworld()
{
// Membuat instance screen baru dan ditampilkan ke layar.
HelloScreen screen = new HelloScreen();
pushScreen(screen);
}

// Screen class
private class HelloScreen extends MainScreen
{
public HelloScreen()
{
// Tentukan title screen
setTitle(new LabelField(“App”, Field.FIELD_HCENTER));
// Tambahkan label hello world ke layar
add(new LabelField(“Hello World!”));
}
}
}




Comments are closed.