/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package UmmiThaharaniLubis;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LENOVO
*/
public class UjianOnlineMidlet extends MIDlet implements CommandListener {
private Display disp;
private Form fData, fSoal, fHasil;
private TextField Nama = new TextField("Nama :", "", 50, TextField.ANY);
private DateField TanggalLahir = new DateField("Tanggal Lahir :", DateField.DATE);
private ChoiceGroup cgGender = new ChoiceGroup("Gender", Choice.EXCLUSIVE);
private ChoiceGroup cgKelas = new ChoiceGroup("Pilihan Kelas", Choice.POPUP);
private ChoiceGroup Soal1, Soal2, Soal3, Soal4, Soal5;
private Command ExitCommand = new Command("Exit", Command.EXIT, 0);
private Command MulaiCommand = new Command("Next", Command.SCREEN, 0);
private Command BatalCommand = new Command("Back", Command.BACK, 0);
private Command SelesaiCommand = new Command("Selesai", Command.SCREEN, 0);
private StringItem sNama, sTanggal, sGender, sKelas;
private String Nm, Tgl, Gen, Kls = null;
public UjianOnlineMidlet() {
}
public Display getDisplay() {
return Display.getDisplay(this);
}
public void startApp() {
disp = Display.getDisplay(this);
fData = new Form("Masukkan Data Anda");
fData.append(Nama);
fData.append(TanggalLahir);
cgGender.append("Male", null);
cgGender.append("Female", null);
fData.append(cgGender);
fData.append(cgKelas);
cgKelas.append("2A", null);
cgKelas.append("2B", null);
cgKelas.append("2C", null);
cgKelas.append("4A", null);
cgKelas.append("4B", null);
cgKelas.append("4C", null);
cgKelas.append("6A", null);
cgKelas.append("6B", null);
fData.addCommand(ExitCommand);
fData.addCommand(MulaiCommand);
fData.setCommandListener(this);
fSoal = new Form("Soal Ujian");
Soal1 = new ChoiceGroup("Jelaskan pengertian malaikat...?", Choice.EXCLUSIVE);
fSoal.append(Soal1);
Soal1.append("malaikat adalah makhluk allah yang gaib diciptakan dari nur, Tugasnya mengabdi kepada Allah", null);
Soal1.append("merupakan manusia yang nyata", null);
Soal1.append("merupakan ruh yang tak berwujud", null);
Soal1.append("merupakan masyarakat yang adil", null);
Soal2 = new ChoiceGroup("Kapan Indonesia Merdeka...?", Choice.EXCLUSIVE);
fSoal.append(Soal2);
Soal2.append(" 12 Januari 1945", null);
Soal2.append(" 18 September 2000", null);
Soal2.append(" 20 Juli 2007", null);
Soal2.append(" 17 Agustus 1945", null);
Soal3 = new ChoiceGroup("Berapa jumlah Nabi dan Rasuluallah...?", Choice.EXCLUSIVE);
fSoal.append(Soal3);
Soal3.append("15", null);
Soal3.append("100", null);
Soal3.append("25", null);
Soal3.append("11", null);
Soal4 = new ChoiceGroup("Siapakah Presiden kita Sekarang...?", Choice.EXCLUSIVE);
fSoal.append(Soal4);
Soal4.append("Susilo", null);
Soal4.append("Soekarno", null);
Soal4.append("Jokowi", null);
Soal4.append("Megawati", null);
Soal5 = new ChoiceGroup("Berapakah jumlah Juz dalam Al-qur'an...?", Choice.EXCLUSIVE);
fSoal.append(Soal5);
Soal5.append("10 Juz", null);
Soal5.append("30 Juz", null);
Soal5.append("11 Juz", null);
Soal5.append("9 Juz", null);
fSoal.addCommand(BatalCommand);
fSoal.addCommand(SelesaiCommand);
fSoal.setCommandListener(this);
fHasil=new Form ("Report Anda");
sNama=new StringItem ("Nama :",null);
sTanggal=new StringItem ("Tanggal Lahir :",null);
sGender=new StringItem ("Gender :",null);
sKelas=new StringItem ("Kelas :",null);
fHasil.append(sNama);
fHasil.append(sTanggal);
fHasil.append(sGender);
fHasil.append(sKelas);
fHasil.addCommand(ExitCommand);
fHasil.setCommandListener(this);
disp.setCurrent(fData);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == ExitCommand)
{ //jika tombol/command Exit ditekan
destroyApp(true);
notifyDestroyed();
} else if (c==MulaiCommand){
if (d==fData){
disp.setCurrent(fSoal);
}
} else if (c == BatalCommand) {
disp.setCurrent(fData);
}
else if(c==SelesaiCommand)
{
Nm = Nama.getString();
Tgl= TanggalLahir.getDate().toString();
Gen= cgGender.getString(cgGender.getSelectedIndex());
Kls= cgKelas.getString(cgKelas.getSelectedIndex());
sNama.setText(Nm);
sTanggal.setText(Tgl);
sGender.setText(Gen);
sKelas.setText(Kls);
disp.setCurrent(fHasil);
}
}
}
Kamis, 30 April 2015
Rabu, 29 April 2015
Perbaikan Tugas Pemesanan Hotel (Ummi Thaharani Lubis, IS-6B)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lubis;
import javax.microedition.midlet.*;
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class reservasiMidlet extends MIDlet implements CommandListener {
Display dis;
Command tipeCommand = new Command("Next", Command.OK, 1);
Command opsiCommand = new Command("Next", Command.OK, 1);
Command reviewCommand = new Command("Review", Command.OK, 1);
Command backreservasiCommand = new Command("Back", Command.OK, 1);
Command backtipeCommand = new Command("Back", Command.OK, 1);
Command exitCommand = new Command("Exit", Command.EXIT, 1);
private static final String kTipe = "Tipe";
private static final String kOpsi = "Fasilitas Lain";
TextField txtNama, txtJumlah;
DateField dCheckIn, dCheckOut;
StringItem Nama, CheckIn, CheckOut, Jumlah, Tipe, Opsi;
private Display mDisplay;
private List mTipeList, mOpsiList;
Form reservasiForm, reviewForm = null;
Alert helloAlert;
public reservasiMidlet() {
super();
reservasiForm = new Form("Reservasi Hotel");
txtNama = new TextField("Nama Pemesan :", "", 20, TextField.ANY);
reservasiForm.append(txtNama);
dCheckIn = new DateField("Check - In :", DateField.DATE);
reservasiForm.append(dCheckIn);
dCheckOut = new DateField("Check - Out", DateField.DATE);
reservasiForm.append(dCheckOut);
txtJumlah = new TextField("Jumlah Orang : ", "", 20, TextField.ANY);
reservasiForm.append(txtJumlah);
reservasiForm.addCommand(tipeCommand);
reservasiForm.addCommand(exitCommand);
reservasiForm.setCommandListener(this);
mTipeList = new List("Pilih Tipe Kamar", List.MULTIPLE);
mTipeList.append("President Suite", null);
mTipeList.append("Extra Deluxe", null);
mTipeList.append("Deluxe", null);
mTipeList.append("Standard", null);
mTipeList.setCommandListener(this);
mTipeList.addCommand(opsiCommand);
mTipeList.addCommand(exitCommand);
mTipeList.setCommandListener(this);
mOpsiList = new List("Other Facility", List.MULTIPLE);
mOpsiList.append("Room Service", null);
mOpsiList.append("Meeting Room", null);
mOpsiList.append("Transportation Service", null);
mOpsiList.append("Laundry And Dry Cleaning", null);
mOpsiList.addCommand(backreservasiCommand);
mOpsiList.addCommand(reviewCommand);
mOpsiList.setCommandListener(this);
reviewForm = new Form("Review");
Nama = new StringItem("Nama Pemesan : ", "");
CheckIn = new StringItem("Check - In :", "");
CheckOut = new StringItem("Check - Out :", "");
Jumlah = new StringItem("Jumlah Orang :", "");
Tipe = new StringItem("Tipe Kamar :", "");
Opsi = new StringItem("Fasilitas Lain :", "");
reviewForm.append(Nama);
reviewForm.append(CheckIn);
reviewForm.append(CheckOut);
reviewForm.append(Jumlah);
reviewForm.append(Tipe);
reviewForm.append(Opsi);
reviewForm.addCommand(backtipeCommand);
reviewForm.addCommand(exitCommand);
reviewForm.setCommandListener(this);
}
public void startApp() {
if (dis == null) {
dis = Display.getDisplay(this);
}
dis.setCurrent(reservasiForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed(); //Exit
} else if (c == backreservasiCommand) {
dis.setCurrent(reservasiForm);
} else if (c == backtipeCommand) {
dis.setCurrent(mTipeList);
} else if (c == tipeCommand) {
dis.setCurrent(mTipeList);
if (c == List.SELECT_COMMAND && d == mTipeList) {
int actionIndex = mTipeList.getSelectedIndex();
if (actionIndex < 0) {
return;
}
String action = mTipeList.getString(actionIndex);
if (action.equals(kTipe)) {
mDisplay.setCurrent(mTipeList);
}
}
} else if (c == opsiCommand) {
dis.setCurrent(mOpsiList);
if (c == List.SELECT_COMMAND && d == mOpsiList) {
int actionIndex = mOpsiList.getSelectedIndex();
if (actionIndex < 0) {
return;
}
String action = mOpsiList.getString(actionIndex);
if (action.equals(kOpsi)) {
mDisplay.setCurrent(mOpsiList);
}
}
} else if (c == reviewCommand) {
try {
Nama.setText(txtNama.getString());
CheckIn.setText(dCheckIn.getDate().toString());
CheckOut.setText(dCheckOut.getDate().toString());
Jumlah.setText(txtJumlah.getString());
if (mTipeList.isSelected(0)) {
Tipe.setText("President Suite");
} else if (mTipeList.isSelected(1)) {
Tipe.setText("Extra Deluxe");
} else if (mTipeList.isSelected(2)) {
Tipe.setText("Deluxe");
} else if (mTipeList.isSelected(3)) {
Tipe.setText("Standard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1))) {
Tipe.setText("President Suite \nExtra Deluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(2))) {
Tipe.setText("President Suite \nDeluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nStandard");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(2))) {
Tipe.setText("Extra Deluxe \nDeluxe");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nStandard");
} else if (mTipeList.isSelected(2) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nStandard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1)) && (mTipeList.isSelected(2))) {
Tipe.setText("President Suite \nExtra Deluxe \nDeluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1)) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nExtra Deluxe \nStandard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(2)) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nDeluxe \nStandard");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(2)) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nDeluxe \nStandard");
} else {
Tipe.setText("Belum Ditentukan");
}
if (mOpsiList.isSelected(0)) {
Opsi.setText("Room Service");
} else if (mOpsiList.isSelected(1)) {
Opsi.setText("Meeting Room");
} else if (mOpsiList.isSelected(2)) {
Opsi.setText("Transportation Service");
} else if (mOpsiList.isSelected(3)) {
Opsi.setText("Laundry And Dry Cleaning");
}else {
Tipe.setText("Belum Ditentukan");
}
dis.setCurrent(reviewForm);
} catch (Exception error) {
dis.setCurrent(new Alert("Review Reservasi Yang Anda Lakukan Gagal", error.getMessage(),
null, AlertType.ERROR));
}
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lubis;
import javax.microedition.midlet.*;
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class reservasiMidlet extends MIDlet implements CommandListener {
Display dis;
Command tipeCommand = new Command("Next", Command.OK, 1);
Command opsiCommand = new Command("Next", Command.OK, 1);
Command reviewCommand = new Command("Review", Command.OK, 1);
Command backreservasiCommand = new Command("Back", Command.OK, 1);
Command backtipeCommand = new Command("Back", Command.OK, 1);
Command exitCommand = new Command("Exit", Command.EXIT, 1);
private static final String kTipe = "Tipe";
private static final String kOpsi = "Fasilitas Lain";
TextField txtNama, txtJumlah;
DateField dCheckIn, dCheckOut;
StringItem Nama, CheckIn, CheckOut, Jumlah, Tipe, Opsi;
private Display mDisplay;
private List mTipeList, mOpsiList;
Form reservasiForm, reviewForm = null;
Alert helloAlert;
public reservasiMidlet() {
super();
reservasiForm = new Form("Reservasi Hotel");
txtNama = new TextField("Nama Pemesan :", "", 20, TextField.ANY);
reservasiForm.append(txtNama);
dCheckIn = new DateField("Check - In :", DateField.DATE);
reservasiForm.append(dCheckIn);
dCheckOut = new DateField("Check - Out", DateField.DATE);
reservasiForm.append(dCheckOut);
txtJumlah = new TextField("Jumlah Orang : ", "", 20, TextField.ANY);
reservasiForm.append(txtJumlah);
reservasiForm.addCommand(tipeCommand);
reservasiForm.addCommand(exitCommand);
reservasiForm.setCommandListener(this);
mTipeList = new List("Pilih Tipe Kamar", List.MULTIPLE);
mTipeList.append("President Suite", null);
mTipeList.append("Extra Deluxe", null);
mTipeList.append("Deluxe", null);
mTipeList.append("Standard", null);
mTipeList.setCommandListener(this);
mTipeList.addCommand(opsiCommand);
mTipeList.addCommand(exitCommand);
mTipeList.setCommandListener(this);
mOpsiList = new List("Other Facility", List.MULTIPLE);
mOpsiList.append("Room Service", null);
mOpsiList.append("Meeting Room", null);
mOpsiList.append("Transportation Service", null);
mOpsiList.append("Laundry And Dry Cleaning", null);
mOpsiList.addCommand(backreservasiCommand);
mOpsiList.addCommand(reviewCommand);
mOpsiList.setCommandListener(this);
reviewForm = new Form("Review");
Nama = new StringItem("Nama Pemesan : ", "");
CheckIn = new StringItem("Check - In :", "");
CheckOut = new StringItem("Check - Out :", "");
Jumlah = new StringItem("Jumlah Orang :", "");
Tipe = new StringItem("Tipe Kamar :", "");
Opsi = new StringItem("Fasilitas Lain :", "");
reviewForm.append(Nama);
reviewForm.append(CheckIn);
reviewForm.append(CheckOut);
reviewForm.append(Jumlah);
reviewForm.append(Tipe);
reviewForm.append(Opsi);
reviewForm.addCommand(backtipeCommand);
reviewForm.addCommand(exitCommand);
reviewForm.setCommandListener(this);
}
public void startApp() {
if (dis == null) {
dis = Display.getDisplay(this);
}
dis.setCurrent(reservasiForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed(); //Exit
} else if (c == backreservasiCommand) {
dis.setCurrent(reservasiForm);
} else if (c == backtipeCommand) {
dis.setCurrent(mTipeList);
} else if (c == tipeCommand) {
dis.setCurrent(mTipeList);
if (c == List.SELECT_COMMAND && d == mTipeList) {
int actionIndex = mTipeList.getSelectedIndex();
if (actionIndex < 0) {
return;
}
String action = mTipeList.getString(actionIndex);
if (action.equals(kTipe)) {
mDisplay.setCurrent(mTipeList);
}
}
} else if (c == opsiCommand) {
dis.setCurrent(mOpsiList);
if (c == List.SELECT_COMMAND && d == mOpsiList) {
int actionIndex = mOpsiList.getSelectedIndex();
if (actionIndex < 0) {
return;
}
String action = mOpsiList.getString(actionIndex);
if (action.equals(kOpsi)) {
mDisplay.setCurrent(mOpsiList);
}
}
} else if (c == reviewCommand) {
try {
Nama.setText(txtNama.getString());
CheckIn.setText(dCheckIn.getDate().toString());
CheckOut.setText(dCheckOut.getDate().toString());
Jumlah.setText(txtJumlah.getString());
if (mTipeList.isSelected(0)) {
Tipe.setText("President Suite");
} else if (mTipeList.isSelected(1)) {
Tipe.setText("Extra Deluxe");
} else if (mTipeList.isSelected(2)) {
Tipe.setText("Deluxe");
} else if (mTipeList.isSelected(3)) {
Tipe.setText("Standard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1))) {
Tipe.setText("President Suite \nExtra Deluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(2))) {
Tipe.setText("President Suite \nDeluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nStandard");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(2))) {
Tipe.setText("Extra Deluxe \nDeluxe");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nStandard");
} else if (mTipeList.isSelected(2) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nStandard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1)) && (mTipeList.isSelected(2))) {
Tipe.setText("President Suite \nExtra Deluxe \nDeluxe");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(1)) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nExtra Deluxe \nStandard");
} else if (mTipeList.isSelected(0) && (mTipeList.isSelected(2)) && (mTipeList.isSelected(3))) {
Tipe.setText("President Suite \nDeluxe \nStandard");
} else if (mTipeList.isSelected(1) && (mTipeList.isSelected(2)) && (mTipeList.isSelected(3))) {
Tipe.setText("Extra Deluxe \nDeluxe \nStandard");
} else {
Tipe.setText("Belum Ditentukan");
}
if (mOpsiList.isSelected(0)) {
Opsi.setText("Room Service");
} else if (mOpsiList.isSelected(1)) {
Opsi.setText("Meeting Room");
} else if (mOpsiList.isSelected(2)) {
Opsi.setText("Transportation Service");
} else if (mOpsiList.isSelected(3)) {
Opsi.setText("Laundry And Dry Cleaning");
}else {
Tipe.setText("Belum Ditentukan");
}
dis.setCurrent(reviewForm);
} catch (Exception error) {
dis.setCurrent(new Alert("Review Reservasi Yang Anda Lakukan Gagal", error.getMessage(),
null, AlertType.ERROR));
}
}
}
}
Kamis, 09 April 2015
tugas 2 java mobile ummi thaharani lubis
registry
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ummimidlet;
import javax.microedition.io.PushRegistry;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.wireless.messaging.*;
/**
* @author OWNER ACER
*/
public class Midletnotifikasipesan extends MIDlet implements CommandListener{
protected static final String kConnection = "sms://:50000";
private Display mDisplay;
private Form mForm;
private Command mExitCommand;
private Command mRegisterCommand, mUnregisterCommand;
public void startApp() {
if (mForm == null) {
mForm = new Form("PushyMIDlet");
mExitCommand = new Command("Exit", Command.EXIT, 0);
mRegisterCommand = new Command("Register",
Command.SCREEN, 0);
mUnregisterCommand = new Command("Unregister",
Command.SCREEN, 0);
mForm.addCommand(mExitCommand);
mForm.addCommand(mRegisterCommand);
mForm.addCommand(mUnregisterCommand);
mForm.setCommandListener(this);
mDisplay = Display.getDisplay(this);
}
mDisplay.setCurrent(mForm);
try {
String[] connections;
connections = PushRegistry.listConnections(false);
if (connections.length > 0) {
mForm.append("Registered connections:");
for (int i = 0; i < connections.length; i++) {
mForm.append(connections[i]);
}
}
connections = PushRegistry.listConnections(true);
if (connections.length > 0) {
// We know there should be only one.
mForm.append("Connections waiting:");
for (int i = 0; i < connections.length; i++) {
mForm.append(" " + connections[i]);
}
}
} catch (Exception e) {
mForm.append(e.toString());
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == mExitCommand) {
destroyApp(true);
notifyDestroyed();
}
else if (c == mRegisterCommand) {
RegisterRunnable rr = new RegisterRunnable(mForm);
Thread t = new Thread(rr);
t.start();
} else if (c == mUnregisterCommand) {
UnregisterRunnable ur = new UnregisterRunnable(mForm);
Thread t = new Thread(ur);
t.start();
}
}
}
class RegisterRunnable implements Runnable {
private Form mForm;
public RegisterRunnable(Form f) {
mForm = f;
}
public void run() {
try {
PushRegistry.registerConnection(
MidletNotifikasiPesan.kConnection, "MidletNotifikasiPesan", "*");
mForm.append("Registered!");
} catch (Exception e) {
mForm.append(e.toString());
}
}
}
class UnregisterRunnable implements Runnable {
private Form mForm;
public UnregisterRunnable(Form f) {
mForm = f;
}
public void run() {
try {
PushRegistry.unregisterConnection(
MidletNotifikasiPesan.kConnection);
mForm.append("Unregistered!");
} catch (Exception e) {
mForm.append(e.toString());
}
}
}
menerima
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package umimidlet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
/**
* @author OWNER ACER
*/
public class Midletumi extends MIDlet implements Runnable, CommandListener {
private TextBox tb;
private String text = "Menunggu pesan...";
private Command okComand;
public Midletumi() {
tb = new TextBox("Hello MIDlet", text, 150, 0);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
protected void startApp() throws MIDletStateChangeException {
Display.getDisplay(this).setCurrent(tb);
new Thread(this).start();
}
public void changeScreen() {
tb = new TextBox("SMS MIDlet", text, 150, 0);
Display.getDisplay(this).setCurrent(tb);
}
public void addConfirmation(String msg) {
tb = new TextBox("SMS MIDlet", text, 150, 0);
tb.setString(msg);
okComand = new Command("OK",Command.OK,1);
tb.addCommand(okComand);
tb.setCommandListener(this);
Display.getDisplay(this).setCurrent(tb);
}
public void run() {
try {
MessageConnection rconn = (MessageConnection) Connector
.open("sms://:1234");
while (true) {
Message msg = rconn.receive();
if (msg instanceof TextMessage) {
TextMessage tmsg = (TextMessage) msg;
String msgOut = tmsg.getPayloadText();
addConfirmation(msgOut);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void commandAction(Command arg0, Displayable arg1) {
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ummimidlet;
import javax.microedition.io.PushRegistry;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.wireless.messaging.*;
/**
* @author OWNER ACER
*/
public class Midletnotifikasipesan extends MIDlet implements CommandListener{
protected static final String kConnection = "sms://:50000";
private Display mDisplay;
private Form mForm;
private Command mExitCommand;
private Command mRegisterCommand, mUnregisterCommand;
public void startApp() {
if (mForm == null) {
mForm = new Form("PushyMIDlet");
mExitCommand = new Command("Exit", Command.EXIT, 0);
mRegisterCommand = new Command("Register",
Command.SCREEN, 0);
mUnregisterCommand = new Command("Unregister",
Command.SCREEN, 0);
mForm.addCommand(mExitCommand);
mForm.addCommand(mRegisterCommand);
mForm.addCommand(mUnregisterCommand);
mForm.setCommandListener(this);
mDisplay = Display.getDisplay(this);
}
mDisplay.setCurrent(mForm);
try {
String[] connections;
connections = PushRegistry.listConnections(false);
if (connections.length > 0) {
mForm.append("Registered connections:");
for (int i = 0; i < connections.length; i++) {
mForm.append(connections[i]);
}
}
connections = PushRegistry.listConnections(true);
if (connections.length > 0) {
// We know there should be only one.
mForm.append("Connections waiting:");
for (int i = 0; i < connections.length; i++) {
mForm.append(" " + connections[i]);
}
}
} catch (Exception e) {
mForm.append(e.toString());
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == mExitCommand) {
destroyApp(true);
notifyDestroyed();
}
else if (c == mRegisterCommand) {
RegisterRunnable rr = new RegisterRunnable(mForm);
Thread t = new Thread(rr);
t.start();
} else if (c == mUnregisterCommand) {
UnregisterRunnable ur = new UnregisterRunnable(mForm);
Thread t = new Thread(ur);
t.start();
}
}
}
class RegisterRunnable implements Runnable {
private Form mForm;
public RegisterRunnable(Form f) {
mForm = f;
}
public void run() {
try {
PushRegistry.registerConnection(
MidletNotifikasiPesan.kConnection, "MidletNotifikasiPesan", "*");
mForm.append("Registered!");
} catch (Exception e) {
mForm.append(e.toString());
}
}
}
class UnregisterRunnable implements Runnable {
private Form mForm;
public UnregisterRunnable(Form f) {
mForm = f;
}
public void run() {
try {
PushRegistry.unregisterConnection(
MidletNotifikasiPesan.kConnection);
mForm.append("Unregistered!");
} catch (Exception e) {
mForm.append(e.toString());
}
}
}
menerima
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package umimidlet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
/**
* @author OWNER ACER
*/
public class Midletumi extends MIDlet implements Runnable, CommandListener {
private TextBox tb;
private String text = "Menunggu pesan...";
private Command okComand;
public Midletumi() {
tb = new TextBox("Hello MIDlet", text, 150, 0);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
protected void startApp() throws MIDletStateChangeException {
Display.getDisplay(this).setCurrent(tb);
new Thread(this).start();
}
public void changeScreen() {
tb = new TextBox("SMS MIDlet", text, 150, 0);
Display.getDisplay(this).setCurrent(tb);
}
public void addConfirmation(String msg) {
tb = new TextBox("SMS MIDlet", text, 150, 0);
tb.setString(msg);
okComand = new Command("OK",Command.OK,1);
tb.addCommand(okComand);
tb.setCommandListener(this);
Display.getDisplay(this).setCurrent(tb);
}
public void run() {
try {
MessageConnection rconn = (MessageConnection) Connector
.open("sms://:1234");
while (true) {
Message msg = rconn.receive();
if (msg instanceof TextMessage) {
TextMessage tmsg = (TextMessage) msg;
String msgOut = tmsg.getPayloadText();
addConfirmation(msgOut);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void commandAction(Command arg0, Displayable arg1) {
}
}
Kamis, 02 April 2015
Tugas Pemograman Java Mobile (Ummi Thaharani Lbs, IS-6B)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugas;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LENOVO
*/
public class tgsMidlet extends MIDlet implements CommandListener {
Display disp;
Form Satu,Dua,Tiga,Home;
Command ExitCommand = new Command("Exit", Command.OK, 1);
Command HomeCommand = new Command("Home", Command.OK, 1);
Command backCommand = new Command("Back", Command.OK, 1);
Command SatuCommand = new Command("Satu", Command.OK,1);
Command DuaCommand = new Command("Dua", Command.OK, 1);
Command TigaCommand = new Command("Tiga", Command.OK, 1);
public tgsMidlet ()
{
Home = new Form ("SELAMAT DATANG!");
Home.addCommand(ExitCommand);
Home.setCommandListener(this);
Home.addCommand(SatuCommand);
Home.addCommand(DuaCommand);
Home.addCommand(TigaCommand);
Satu = new Form ("Ini Adalah Halaman Pertama");
Satu.addCommand(HomeCommand);
Satu.setCommandListener(this);
Satu.addCommand(DuaCommand);
Satu.addCommand(TigaCommand);
Satu.addCommand(ExitCommand);
Satu.setCommandListener(this);
Dua = new Form("Ini Adalah Halaman Kedua");
Dua.addCommand(HomeCommand);
Dua.setCommandListener(this);
Dua.addCommand(SatuCommand);
Dua.addCommand(TigaCommand);
Dua.addCommand(ExitCommand);
Dua.setCommandListener(this);
Tiga = new Form("Ini Adalah Halaman Ketiga");
Tiga.addCommand(HomeCommand);
Tiga.setCommandListener(this);
Tiga.addCommand(SatuCommand);
Tiga.addCommand(DuaCommand);
Tiga.addCommand(ExitCommand);
Tiga.setCommandListener(this);
}
public void startApp() {
if (disp == null) {
disp = Display.getDisplay(this);
}
disp.setCurrent(Home);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == ExitCommand)
{
destroyApp(true);
notifyDestroyed(); // Exit
}
else if (c == SatuCommand)
{
disp.setCurrent(Satu);
}
else if (c == DuaCommand)
{
disp.setCurrent(Dua);
}
else if (c == TigaCommand)
{
disp.setCurrent(Tiga);
}
else if (c == HomeCommand)
{
disp.setCurrent(Home);
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugas;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LENOVO
*/
public class tgsMidlet extends MIDlet implements CommandListener {
Display disp;
Form Satu,Dua,Tiga,Home;
Command ExitCommand = new Command("Exit", Command.OK, 1);
Command HomeCommand = new Command("Home", Command.OK, 1);
Command backCommand = new Command("Back", Command.OK, 1);
Command SatuCommand = new Command("Satu", Command.OK,1);
Command DuaCommand = new Command("Dua", Command.OK, 1);
Command TigaCommand = new Command("Tiga", Command.OK, 1);
public tgsMidlet ()
{
Home = new Form ("SELAMAT DATANG!");
Home.addCommand(ExitCommand);
Home.setCommandListener(this);
Home.addCommand(SatuCommand);
Home.addCommand(DuaCommand);
Home.addCommand(TigaCommand);
Satu = new Form ("Ini Adalah Halaman Pertama");
Satu.addCommand(HomeCommand);
Satu.setCommandListener(this);
Satu.addCommand(DuaCommand);
Satu.addCommand(TigaCommand);
Satu.addCommand(ExitCommand);
Satu.setCommandListener(this);
Dua = new Form("Ini Adalah Halaman Kedua");
Dua.addCommand(HomeCommand);
Dua.setCommandListener(this);
Dua.addCommand(SatuCommand);
Dua.addCommand(TigaCommand);
Dua.addCommand(ExitCommand);
Dua.setCommandListener(this);
Tiga = new Form("Ini Adalah Halaman Ketiga");
Tiga.addCommand(HomeCommand);
Tiga.setCommandListener(this);
Tiga.addCommand(SatuCommand);
Tiga.addCommand(DuaCommand);
Tiga.addCommand(ExitCommand);
Tiga.setCommandListener(this);
}
public void startApp() {
if (disp == null) {
disp = Display.getDisplay(this);
}
disp.setCurrent(Home);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == ExitCommand)
{
destroyApp(true);
notifyDestroyed(); // Exit
}
else if (c == SatuCommand)
{
disp.setCurrent(Satu);
}
else if (c == DuaCommand)
{
disp.setCurrent(Dua);
}
else if (c == TigaCommand)
{
disp.setCurrent(Tiga);
}
else if (c == HomeCommand)
{
disp.setCurrent(Home);
}
}
}
Tugas Ummi Thaharani lubis, IS-6B
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugas;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LENOVO
*/
public class tgsMidlet extends MIDlet implements CommandListener {
Display disp;
Form Satu,Dua,Tiga,Home;
Command ExitCommand = new Command("Exit", Command.OK, 1);
Command HomeCommand = new Command("Home", Command.OK, 1);
Command backCommand = new Command("Back", Command.OK, 1);
Command SatuCommand = new Command("Satu", Command.OK,1);
Command DuaCommand = new Command("Dua", Command.OK, 1);
Command TigaCommand = new Command("Tiga", Command.OK, 1);
public tgsMidlet ()
{
Home = new Form ("SELAMAT DATANG!");
Home.addCommand(ExitCommand);
Home.setCommandListener(this);
Home.addCommand(SatuCommand);
Home.addCommand(DuaCommand);
Home.addCommand(TigaCommand);
Satu = new Form ("Ini Adalah Halaman Pertama");
Satu.addCommand(HomeCommand);
Satu.setCommandListener(this);
Satu.addCommand(DuaCommand);
Satu.addCommand(TigaCommand);
Satu.addCommand(ExitCommand);
Satu.setCommandListener(this);
Dua = new Form("Ini Adalah Halaman Kedua");
Dua.addCommand(HomeCommand);
Dua.setCommandListener(this);
Dua.addCommand(SatuCommand);
Dua.addCommand(TigaCommand);
Dua.addCommand(ExitCommand);
Dua.setCommandListener(this);
Tiga = new Form("Ini Adalah Halaman Ketiga");
Tiga.addCommand(HomeCommand);
Tiga.setCommandListener(this);
Tiga.addCommand(SatuCommand);
Tiga.addCommand(DuaCommand);
Tiga.addCommand(ExitCommand);
Tiga.setCommandListener(this);
}
public void startApp() {
if (disp == null) {
disp = Display.getDisplay(this);
}
disp.setCurrent(Home);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == ExitCommand)
{
destroyApp(true);
notifyDestroyed(); // Exit
}
else if (c == SatuCommand)
{
disp.setCurrent(Satu);
}
else if (c == DuaCommand)
{
disp.setCurrent(Dua);
}
else if (c == TigaCommand)
{
disp.setCurrent(Tiga);
}
else if (c == HomeCommand)
{
disp.setCurrent(Home);
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tugas;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author LENOVO
*/
public class tgsMidlet extends MIDlet implements CommandListener {
Display disp;
Form Satu,Dua,Tiga,Home;
Command ExitCommand = new Command("Exit", Command.OK, 1);
Command HomeCommand = new Command("Home", Command.OK, 1);
Command backCommand = new Command("Back", Command.OK, 1);
Command SatuCommand = new Command("Satu", Command.OK,1);
Command DuaCommand = new Command("Dua", Command.OK, 1);
Command TigaCommand = new Command("Tiga", Command.OK, 1);
public tgsMidlet ()
{
Home = new Form ("SELAMAT DATANG!");
Home.addCommand(ExitCommand);
Home.setCommandListener(this);
Home.addCommand(SatuCommand);
Home.addCommand(DuaCommand);
Home.addCommand(TigaCommand);
Satu = new Form ("Ini Adalah Halaman Pertama");
Satu.addCommand(HomeCommand);
Satu.setCommandListener(this);
Satu.addCommand(DuaCommand);
Satu.addCommand(TigaCommand);
Satu.addCommand(ExitCommand);
Satu.setCommandListener(this);
Dua = new Form("Ini Adalah Halaman Kedua");
Dua.addCommand(HomeCommand);
Dua.setCommandListener(this);
Dua.addCommand(SatuCommand);
Dua.addCommand(TigaCommand);
Dua.addCommand(ExitCommand);
Dua.setCommandListener(this);
Tiga = new Form("Ini Adalah Halaman Ketiga");
Tiga.addCommand(HomeCommand);
Tiga.setCommandListener(this);
Tiga.addCommand(SatuCommand);
Tiga.addCommand(DuaCommand);
Tiga.addCommand(ExitCommand);
Tiga.setCommandListener(this);
}
public void startApp() {
if (disp == null) {
disp = Display.getDisplay(this);
}
disp.setCurrent(Home);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == ExitCommand)
{
destroyApp(true);
notifyDestroyed(); // Exit
}
else if (c == SatuCommand)
{
disp.setCurrent(Satu);
}
else if (c == DuaCommand)
{
disp.setCurrent(Dua);
}
else if (c == TigaCommand)
{
disp.setCurrent(Tiga);
}
else if (c == HomeCommand)
{
disp.setCurrent(Home);
}
}
}
Kamis, 18 Desember 2014
Banyak Bayi Yang Meninggal di Daerah Pinggiran Pantai
Latar Belakang :
Banyak bayi yang meniggal di daerah pinggiran pantai menjadi suatu hal permasalahan. Oleh karena itu merupakan hal yang wajib untuk di teliti. Tetapi dari penelitian belum memberikan hasil. Apakah daerah pinggiran pantai Sangat memberikan pengaruh terhadap kesehatan bayi yang meninggal atau tingkat gizi yang di konsumsi bayi tersebut. Karena itu saya tertarik untuk melakukan penelitiaan. Dan dapat memberikan informasi yang akurat kepada masyarakat.
Rumusan Masalah:
Apakah Makanan yang di konsumsi bayi Tidak Baik untuk imun bayi?
Banyak bayi yang meniggal di daerah pinggiran pantai menjadi suatu hal permasalahan. Oleh karena itu merupakan hal yang wajib untuk di teliti. Tetapi dari penelitian belum memberikan hasil. Apakah daerah pinggiran pantai Sangat memberikan pengaruh terhadap kesehatan bayi yang meninggal atau tingkat gizi yang di konsumsi bayi tersebut. Karena itu saya tertarik untuk melakukan penelitiaan. Dan dapat memberikan informasi yang akurat kepada masyarakat.
Rumusan Masalah:
Apakah Makanan yang di konsumsi bayi Tidak Baik untuk imun bayi?
Rabu, 22 Oktober 2014
METODELOGI PENELITIAN
Topik Penelitian : Prakiraan Cuaca Berdasarkan Komputer
Rumusan Masalah : Bagaimana proses dalam penggunaan Komputer untuk prakiraan cuaca sehingga dapat memberikan informasi kepada masyarakat?
Rumusan Masalah : Bagaimana proses dalam penggunaan Komputer untuk prakiraan cuaca sehingga dapat memberikan informasi kepada masyarakat?
Langganan:
Postingan (Atom)