WELCOME MAXER INDONESIA
 
HomeCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Pelajaran no. 3 (aplikasi berbasis menu Kedua)

Go down 
AuthorMessage
lord
Admin
lord

Jumlah posting : 86
Join date : 2009-05-09
Age : 28
Lokasi : Bekasi-Indonesia

PostSubject: Pelajaran no. 3 (aplikasi berbasis menu Kedua)   Fri Feb 19, 2010 6:16 pm

Hi all,
aku akn menemukan hal-hal di sekitar akan intresting Apakah kalian intrested untuk membuat aplikasi kedua.
Saya pikir akan lebih baik untuk membuat aplikasi berbasis menu sehingga akan mudah bagi kita untuk melakukan variabel dan contoh-contoh mendatang ... Smile
Sekarang saya tambahkan beberapa baris untuk "hello world" proyek.
CATATAN: baris berikut dengan / / adalah komentar yang tidak pada effct punya aplikasi. Saya hanya menjelaskan kode ditambahkan baru menambahkan / / di depan. Periksa kode:
Code:

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

public class HelloWorld extends MIDlet implements CommandListener{
private Form form;
private Form form2; // This is new form
private Display display;
private Command exitCommand; //this is exit command
private Command max99; //this is max99 command

public HelloWorld(){
display = Display.getDisplay(this);
form = new Form("Hello world");
form2 = new Form("Max99"); //we just defined new form
exitCommand = new Command("Exit", 1, 1); //defined names and position for exitcommand
max99 = new Command("Max99 page", 1, 2);//defined names and position for max99 page command
form.addCommand(exitCommand); //we just added exitcommand in first form..you also can add this command in second form like form2.addCommand(exitCommand);
form.addCommand(max99);//added max99 menu command in first form
String msg = "Welcome to max99 zone. Please click on menu to get more information";
String msg1 = "Max99 is a global mobile instant messenger";//we added new string
form.append(msg);
form2.append(msg1);//we are just displaying second string to new form2
form.setCommandListener(this); //states that program has to listen for user commands of first form if you are going to add any menu commands then you should add this line
//if you are going to add exit command in second form then you need to add here new line like form2.setCommandListener(this);

}


public void startApp(){



display.setCurrent(form); //this states that at startup from form will be displayed


}

public void pauseApp(){}

public void destroyApp(boolean unconditional){
notifyDestroyed();
}
public void commandAction(Command cmd, Displayable disp) {
//this defined hoe to handle menu commands
//if someone click to exitcommand then the app will close..so notifyDestroyed(); this function closes the application
if (cmd==exitCommand)
{
notifyDestroyed();
}
//if clicked to max99 page then it sets current screen to new form where second string is displayed
if (cmd==max99)
{
display.setCurrent(form2);
}
}
}

Anda dapat memeriksa kode iklan setidaknya understandwhat yang kamu lakukan ... Saya akan senang melihat banyak menu perintah dan pesan yang lebih appeneded dalam bentuk ... saya akan menunggu aplikasi kedua yang lebih maju.
Lookng membingungkan Donot mendapatkan kode aplikasi dengan komentar-komentar .. i am memberikan Anda kode tanpa komentar berarti tanpa menjelaskan garis terlalu .. ini:

Code:

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

public class HelloWorld extends MIDlet implements CommandListener{
private Form form;
private Form form2;
private Display display;
private Command exitCommand;
private Command max99;

public HelloWorld(){
display = Display.getDisplay(this);
form = new Form("Hello world");
form2 = new Form("Max99");
exitCommand = new Command("Exit", 1, 1);
max99 = new Command("Max99 page", 1, 2);
form.addCommand(exitCommand);
form.addCommand(max99);
String msg = "Welcome to max99 zone. Please click on menu to get more information";
String msg1 = "Max99 is a global mobile instant messenger";
form.append(msg);
form2.append(msg1);
form.setCommandListener(this);

}


public void startApp(){
display.setCurrent(form);
}

public void pauseApp(){}

public void destroyApp(boolean unconditional){
notifyDestroyed();
}
public void commandAction(Command cmd, Displayable disp) {
if (cmd==exitCommand)
{
notifyDestroyed();
}
if (cmd==max99)
{
display.setCurrent(form2);
}
}
}

best of luck king

_________________
Back to top Go down
View user profile http://lordarea.forumpro.in
 
Pelajaran no. 3 (aplikasi berbasis menu Kedua)
Back to top 
Page 1 of 1
 Similar topics
-
» Selection of sub menus in Selenium IDE
» selecting dropdown list using selenium
» how to count number of items present in dropdown
» javascript Menu item

Permissions in this forum:You cannot reply to topics in this forum
max99 indonesia :: Extra :: kursus j2me-
Jump to: