file: Screen_Main.java

package testing;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.decor.Background;
import net.rim.device.api.ui.decor.BackgroundFactory;

public class Screen_Main extends MainScreen {

private VerticalFieldManager _manager;
private Bitmap               objBitmap;

public Screen_Main() {

//change background color
_manager = (VerticalFieldManager)getMainManager();
objBitmap = Bitmap.getBitmapResource( “blue_grad_background.png”);

//Background bg = BackgroundFactory.createLinearGradientBackground(Color.AQUA, Color.ALICEBLUE, Color.BEIGE, Color.BLANCHEDALMOND);
//Background bg = BackgroundFactory.createSolidBackground(Color.BLUE);
Background bg = BackgroundFactory.createBitmapBackground(objBitmap);
_manager.setBackground(bg);

//Field Manager//

//Pengaturan Layout Vertical//
VerticalFieldManager titleIcon = new VerticalFieldManager(Field.USE_ALL_WIDTH);
VerticalFieldManager titleText = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT);

//Pengaturan Layout Horizontal//
HorizontalFieldManager ICON = new HorizontalFieldManager(Field.FIELD_HCENTER);
HorizontalFieldManager TEXT = new HorizontalFieldManager(Field.FIELD_HCENTER);
HorizontalFieldManager TEXT2 = new HorizontalFieldManager(Field.FIELD_HCENTER);
HorizontalFieldManager TEXT3 = new HorizontalFieldManager(Field.FIELD_HCENTER);

//Menambahkan Icon//
titleIcon.add(ICON);

//Menambahkan Text//
titleText.add(TEXT);
titleText.add(TEXT2);
titleText.add(TEXT3);

//Bitmaps//
BitmapField titleBitmap = new BitmapField(Bitmap.getBitmapResource(“Firefox.png”));
ICON.add(titleBitmap);

//Labels//
LabelField Text = new LabelField(“Wahyu Kurniawan”) {
public void paint(Graphics g){
g.setColor(Color.SALMON);
super.paint(g);
}
};

LabelField Text2 = new LabelField(“http://www.wahyukurniawan.info”) {
public void paint(Graphics g){
g.setColor(Color.WHITE);
super.paint(g);
}
};

LabelField Text3 = new LabelField(“Best viewed with Mozilla Firefox”) {
public void paint(Graphics g){
g.setColor(Color.BLUEVIOLET);
super.paint(g);
}
};

//Setting Font Style
Font style1 = this.getFont().derive(Font.BOLD | Font.ITALIC);
Font style2 = this.getFont().derive(Font.BOLD);
Text.setFont(style1);
Text2.setFont(style2);

// Pemberian judul Aplikasi di MainScreen
LabelField judul = new LabelField(“CONTOH BLACKBERRY UI”, LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
setTitle(judul);

TEXT.add(Text);
TEXT2.add(Text2);
TEXT3.add(Text3);

//Initialize the Screen//
add(titleIcon);
add(titleText);

}

}

file: start.java

package testing;

import net.rim.device.api.ui.UiApplication;

public class start extends UiApplication {

public start() {
Screen_Main SCREEN = new Screen_Main();
//Screen_Main1 SCREEN = new Screen_Main1();
//Screen_Main2 SCREEN = new Screen_Main2();
pushScreen(SCREEN);
}

public static void main(String args[]) {
start APP = new start();
APP.enterEventDispatcher();
}
}