package ticker;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
/**
* The Ticker Demo simply sets a rather long ticker to the screen.
*
* @version 2.0
*/
public class TickerDemo extends MIDlet implements CommandListener {
/**
* This is the text displayed in the ticker.
*/
private static final String TICKER_TEXT =
"Ini adalah Tugas dari kelompok kami " + "scroll along the way... On and on it goes without " +
"stopping even for a second!";
private boolean firstTime;
private Form mainForm;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Display myDisplay;
private Ticker t;
public TickerDemo() {
myDisplay = Display.getDisplay(this);
firstTime = true;
mainForm = new Form("Tugas Pak Andika");
mainForm.setCommandListener(this);
mainForm.setCommandListener(this);
}
protected void startApp() {
if (firstTime) {
t = new Ticker(TICKER_TEXT);
mainForm.setTicker(t);
firstTime = false;
}
mainForm.addCommand(exitCommand);
myDisplay.setCurrent(mainForm);
}
protected void destroyApp(boolean unconditional) {
myDisplay.setCurrent((Displayable)null);
notifyDestroyed();
}
protected void pauseApp() {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(true);
}
}
}
Kamis, 11 November 2010
Membuat Date Field dengan Java ME
package datefield;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
/**
* The date field demo simply shows a date component on the screen with 3
* settings (Date, Time, Date & Time).
*
* @version 2.0
*/
public class DateFieldDemo extends MIDlet implements CommandListener {
private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
private boolean firstTime;
private Form mainForm;
public DateFieldDemo() {
firstTime = true;
mainForm = new Form("Alert Options");
}
protected void startApp() {
if (firstTime) {
mainForm.append(new DateField("Date", DateField.DATE));
mainForm.append(new DateField("Time", DateField.TIME));
mainForm.append(new DateField("Date & Time", DateField.DATE_TIME));
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
firstTime = false;
}
Display.getDisplay(this).setCurrent(mainForm);
}
protected void destroyApp(boolean unconditional) {
}
protected void pauseApp() {
}
public void commandAction(Command c, Displayable d) {
if (c == CMD_EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
/**
* The date field demo simply shows a date component on the screen with 3
* settings (Date, Time, Date & Time).
*
* @version 2.0
*/
public class DateFieldDemo extends MIDlet implements CommandListener {
private static final Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
private boolean firstTime;
private Form mainForm;
public DateFieldDemo() {
firstTime = true;
mainForm = new Form("Alert Options");
}
protected void startApp() {
if (firstTime) {
mainForm.append(new DateField("Date", DateField.DATE));
mainForm.append(new DateField("Time", DateField.TIME));
mainForm.append(new DateField("Date & Time", DateField.DATE_TIME));
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
firstTime = false;
}
Display.getDisplay(this).setCurrent(mainForm);
}
protected void destroyApp(boolean unconditional) {
}
protected void pauseApp() {
}
public void commandAction(Command c, Displayable d) {
if (c == CMD_EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
Membuat Data Diri Dengan Java ME
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package datadiri;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* @author sophie
*/
public class DataDiriDemo extends MIDlet implements CommandListener{
private static final Command CMD_EXIT = new Command ("Exit",Command.EXIT, 1);
private static final Command CMD_OK = new Command ("Exit",Command.OK, 2);
public static final String[] gender = {"Laki-Laki","Perempuan"};
private boolean firstTime;
private Form mainForm;
private Display display;
public DataDiriDemo() {
firstTime = true;
mainForm = new Form ("Data Diri");
}
public void startApp() {
display = Display.getDisplay (this);
if(firstTime){
mainForm.append(new TextField("Nama","",15,TextField.ANY));
mainForm.append(new TextField("Telepon","",15,TextField.PHONENUMBER));
ChoiceGroup jenis =new ChoiceGroup ("Jenis Kelamin", ChoiceGroup.EXCLUSIVE,gender,null);
mainForm.append(jenis);
mainForm.append(new DateField("Tanggal Lahir", DateField.DATE));
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
firstTime = false;
}
Display.getDisplay(this).setCurrent(mainForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == CMD_EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package datadiri;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* @author sophie
*/
public class DataDiriDemo extends MIDlet implements CommandListener{
private static final Command CMD_EXIT = new Command ("Exit",Command.EXIT, 1);
private static final Command CMD_OK = new Command ("Exit",Command.OK, 2);
public static final String[] gender = {"Laki-Laki","Perempuan"};
private boolean firstTime;
private Form mainForm;
private Display display;
public DataDiriDemo() {
firstTime = true;
mainForm = new Form ("Data Diri");
}
public void startApp() {
display = Display.getDisplay (this);
if(firstTime){
mainForm.append(new TextField("Nama","",15,TextField.ANY));
mainForm.append(new TextField("Telepon","",15,TextField.PHONENUMBER));
ChoiceGroup jenis =new ChoiceGroup ("Jenis Kelamin", ChoiceGroup.EXCLUSIVE,gender,null);
mainForm.append(jenis);
mainForm.append(new DateField("Tanggal Lahir", DateField.DATE));
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
firstTime = false;
}
Display.getDisplay(this).setCurrent(mainForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == CMD_EXIT) {
destroyApp(false);
notifyDestroyed();
}
}
}
Boneka Wajah dari Flanel
Donat dari kain Flanel
Dolpin dari Kain Flanel
Langganan:
Postingan (Atom)