Sabtu, 23 Maret 2013

Mobile Java Programming - Class Alert

Assalamua'laikum wr.wb.

In the Last meeting  I have studied about mobile java programming is about Class Alert. An alert is a screen that shows data to the user and waits for a certain period of time before proceeding to the next Displayable. An alert can contain a text string and an image. The intended use of Alert is to inform the user about errors and other exceptional conditions.

The following is an example of script of Class Alert and also our task last meeting in the class of java programming.

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

 * @author JailaniLc
public class Task_alert_modify extends MIDlet implements CommandListener {
Display display;
Form mainForm;
StringItem helloAlertString;
Command exitCommand = new Command ("Exit", Command.EXIT,1);
Command whyCommand = new Command ("Why?", Command.OK,1);
Command backCommand = new Command ("Back", Command.BACK,1);
Alert helloAlert;

public Task_alert_modify (){
helloAlertString = new StringItem("This is an example ","of the use of class Alert in java");
mainForm = new Form("Bahar Noer", new Item[] { helloAlertString});
helloAlert = new Alert("Attention","An alert is a screen that shows data to the user and waits for a certain period of time before proceeding to the next Displayable", null,AlertType.INFO);
    public void startApp() {
if (display==null){
display = Display.getDisplay(this);
public void pauseApp() {
public void destroyApp(boolean unconditional) {
public void commandAction(Command c, Displayable d){
if (c == exitCommand){
notifyDestroyed(); // Exit
if (c == whyCommand){
if(c == backCommand){


Simulator interface :

 1. Main view of simulator aplication .  Click on task_alert_modify .

Picture 1. Main view of simulator aplication 
2. will appear as follow picture. Next, click on "Why ?"...

Picture 2. Appereance of Task_Alert_Modify
3. Then will appear the Alert of Attention as below.

Picture 3. the alert that appear after click on "Why?".
May it useful...
thanks. . . :)

Tidak ada komentar:

Posting Komentar