SlideShare a Scribd company logo
1
Koneksi php:
<?
$j = $_POST["j"];
$p = $_POST["p"];
$c=
mysql_connect("localhost","root","");
mysql_select_db("mobile",$c);
$sql= "insert into `buku`(judul,
penulis) values('$j','$p')";
if($run=mysql_query($sql,$c))
{
echo "ok <br>";
echo "Judul Buku :".$j."<br>";
echo "Penulis : ".$p."<br>";
}
else
{
echo mysql_error();
}
?>
Kirim data ke server :
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class SendData extends MIDlet
implements CommandListener {
Form f1, f2;
TextField Judul,Penulis;
Command submit, back;
StringItem si;
Display tampilan;
public SendData(){
f1 = new Form("HTTP
Connection");//judul form1
Judul = new TextField
("Judul","",40,TextField.ANY);
Penulis = new TextField
("Penulis","",40,TextField.ANY);
submit = new
Command("Submit",Command.OK,1);
//new command("label",jenis, prioritas)
f1.append(Judul);//aktifkan fungsi
form input
f1.append(Penulis);
f1.addCommand(submit);
f1.setCommandListener(this);
f2 = new Form("");
back=new
Command("back",Command.BACK,1)
;
si=new StringItem("Respon
Server","",1);
f2.append(si);
f2.setCommandListener(this);
}
public void submit(){
InputStream in = null;
String
url="http://localhost/koneksi.php";
HttpConnection c=null;
OutputStream out = null;
try{
c =
(HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.P
OST);
c.setRequestProperty("Content-
Type","application/x-www-form-
urlencoded");
out=c.openOutputStream();
byte data[];
data=("j="+Judul.getString()).getBytes
();
out.write(data);
data=("&p="+Penulis.getString()).getB
ytes();
out.write(data);
out.flush();
in=c.openInputStream();
StringBuffer buff= new
StringBuffer();
int i;
while((i=in.read())!=-1)
{
if (i!='n')
buff.append((char)i);
else
{
si.setText(buff.toString());
buff.delete(0,buff.length());
}
}
si.setText(si.getText()+buff.toString());
tampilan.setCurrent(f2);
}
catch(IOException e){
}
}
public void kembali(){
tampilan.setCurrent(f1);
}
public void startApp() {
tampilan=Display.getDisplay(this);
tampilan.setCurrent(f1);
}
public void pauseApp() {
}
public void destroyApp(boolean
unconditional) {
}
public void
commandAction(Command c,
Displayable d) {
//throw new
UnsupportedOperationException("Not
supported yet.");
if(c.equals(submit))
{
submit();
}
else
{
if(c.equals(back))
{
kembali();
}
}
}
}
User interface n comnand listener :
Class display ;
Display Tampilan;
Tampilan.getdisplay(this)
Tampilan setCurrent(displayable next)
Form f;
F = newform (“judul form”);
Text field;
Command exit
Exit= new
command(“label”,jenisurutan)
Tampil gambar :
Class tampil gambar extend midlet(){
Form f;
Display d;
Public tampil Gambar ()
{
F = new form (“tampil gambar”)
Try{
Image gbr=new image(“h.jpg”);
f.append(gbr);
}
Catch (io exception e)
{
}
}
Web server
Test.php
Text box tb
Tb=new Textbox(“judul”,”isi”,
panjang,jenis);
Tb.addcommand
Tb.set commandListener;
StreamConection C;
C=(StreamConnection)
connector.open(url);
http connection.con = null;
data InputStream in = null;
String URL = “.....”;
Try{
Con = (http connection)
connector.open(url);
Int panjang = (int) con.getLenght();
Byte[] buff = null;
If ( panjang = -1) {
Buff= new byte[panjang] // bikin
buffer
In =new Data Input Stream(con)
In.read Fully(buff);
}
2
Membuat record store:
/*
* To change this template, choose
Tools | Templates
* and open the template in the editor.
*/
import javax.microedition.rms.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class newDatabaseRMS extends
MIDletimplements CommandListener{
private Display display;
private Command createcmd = new
Command ("buat", Command.OK,1);
private Command exitCmd = new
Command("keluar",
Command.EXIT,2);
private Form f;
private TextField t;
private RecordStore myDb;
private Ticker tck;
public newDatabaseRMS(){
}
}
/**
* @author 1945
*/
public class recordstore extends
MIDlet {
public void startApp() {
display =
Display.getDisplay(this);
f = new Form("pemrograman
RMS");
t = new TextField("nama
Record
Store",null,32,TextField.ANY);
tck = new Ticker("");
f.append(t);
f.addCommand(createCmd);
f.addCommand(exitCmd);
f.addCommandListener(this);
f.setTicker(tck);
display.setCurrent(f);
}
public void buat Db(){
try{
myDb =
RecordStore.openRecordStore(t.getStri
ng(), true);
tck.setString ("Database" +
t.getString() + "berhasil di buat");
display.setCurrent(f);
}catch (RecordStoreException e ){
tck.setString ("ada kesalahan
pembuatan database");
display.setCurrent(f);
}
}
public void keluar(){
this.destroyApp(true);
}
public void CommandAction
(Command c, Displayable d){
String[b] = c.getLabel();
if (lbl.equals("keluar")){
keluar();
}else if (lbl.equals("but")){
butDb();
}
}
public void pauseApp() {
//do Nothing
}
public void destroyApp(boolean
unconditional) {
notifyDestroyed();
}
}

More Related Content

What's hot

Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworks
Bruno Rocha
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
Henri Binsztok
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
PROIDEA
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
NexThoughts Technologies
 
TDD in the wild
TDD in the wildTDD in the wild
TDD in the wild
Brainhub
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Domenic Denicola
 
Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
Simon Elliston Ball
 
Productive Programming in Groovy
Productive Programming in GroovyProductive Programming in Groovy
Productive Programming in Groovy
Ganesh Samarthyam
 
4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers
PROIDEA
 
Tools and Projects Dec 2018 Edition
Tools and Projects Dec 2018 EditionTools and Projects Dec 2018 Edition
Tools and Projects Dec 2018 Edition
Jesus Manuel Olivas
 
HeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP ClientHeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP Client
Dimitar Ivanov
 
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Codemotion
 
MongoDB
MongoDBMongoDB
MongoDB
Steve Klabnik
 
Mongo db for C# Developers
Mongo db for C# DevelopersMongo db for C# Developers
Mongo db for C# Developers
Simon Elliston Ball
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3
markstory
 
Unit testing powershell
Unit testing powershellUnit testing powershell
Unit testing powershell
Matt Wrock
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
Qiangning Hong
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
Tsuyoshi Yamamoto
 
PowerShell Technical Overview
PowerShell Technical OverviewPowerShell Technical Overview
PowerShell Technical Overview
allandcp
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 

What's hot (20)

Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworks
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
TDD in the wild
TDD in the wildTDD in the wild
TDD in the wild
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 
Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
 
Productive Programming in Groovy
Productive Programming in GroovyProductive Programming in Groovy
Productive Programming in Groovy
 
4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers
 
Tools and Projects Dec 2018 Edition
Tools and Projects Dec 2018 EditionTools and Projects Dec 2018 Edition
Tools and Projects Dec 2018 Edition
 
HeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP ClientHeadCouch - CouchDB PHP Client
HeadCouch - CouchDB PHP Client
 
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo db for C# Developers
Mongo db for C# DevelopersMongo db for C# Developers
Mongo db for C# Developers
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3
 
Unit testing powershell
Unit testing powershellUnit testing powershell
Unit testing powershell
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
 
PowerShell Technical Overview
PowerShell Technical OverviewPowerShell Technical Overview
PowerShell Technical Overview
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 

Viewers also liked

The State of Global Markets 2013
The State of Global Markets 2013The State of Global Markets 2013
The State of Global Markets 2013
Envision Technology Advisors
 
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaal
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaalSessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaal
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaalVereniging Vlaamse Jeugddiensten
 
140331_Shang Xian square_lores (2)
140331_Shang Xian square_lores (2)140331_Shang Xian square_lores (2)
140331_Shang Xian square_lores (2)
Jerry Geurts
 
Pathway you
Pathway youPathway you
Pathway you
Martin Deal
 
Express Computers
Express ComputersExpress Computers
Express ComputersReema Sarin
 
Gov.uk content schemas tech monthly may 2015
Gov.uk content schemas   tech monthly may 2015Gov.uk content schemas   tech monthly may 2015
Gov.uk content schemas tech monthly may 2015
David Heath
 
The Riot Club Trailer Analysis
The Riot Club Trailer Analysis The Riot Club Trailer Analysis
The Riot Club Trailer Analysis
LMessider
 
RamaRaju_Profile
RamaRaju_ProfileRamaRaju_Profile
RamaRaju_Profile
Ramaraju Dantuluri
 
Nike TaiWan GuanFang Wang 3780
Nike TaiWan GuanFang Wang 3780Nike TaiWan GuanFang Wang 3780
Nike TaiWan GuanFang Wang 3780
learneddent4790
 
16112014 (VIJAY NEWS)
16112014 (VIJAY NEWS)16112014 (VIJAY NEWS)
16112014 (VIJAY NEWS)
VIJAY NEWS
 
Microsoft office access 2003
Microsoft office access 2003Microsoft office access 2003
Microsoft office access 2003
Nisrina Khalilah
 

Viewers also liked (11)

The State of Global Markets 2013
The State of Global Markets 2013The State of Global Markets 2013
The State of Global Markets 2013
 
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaal
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaalSessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaal
Sessie 55 A4 over_het_muurtje_de_jeugddienst_gaat_internationaal
 
140331_Shang Xian square_lores (2)
140331_Shang Xian square_lores (2)140331_Shang Xian square_lores (2)
140331_Shang Xian square_lores (2)
 
Pathway you
Pathway youPathway you
Pathway you
 
Express Computers
Express ComputersExpress Computers
Express Computers
 
Gov.uk content schemas tech monthly may 2015
Gov.uk content schemas   tech monthly may 2015Gov.uk content schemas   tech monthly may 2015
Gov.uk content schemas tech monthly may 2015
 
The Riot Club Trailer Analysis
The Riot Club Trailer Analysis The Riot Club Trailer Analysis
The Riot Club Trailer Analysis
 
RamaRaju_Profile
RamaRaju_ProfileRamaRaju_Profile
RamaRaju_Profile
 
Nike TaiWan GuanFang Wang 3780
Nike TaiWan GuanFang Wang 3780Nike TaiWan GuanFang Wang 3780
Nike TaiWan GuanFang Wang 3780
 
16112014 (VIJAY NEWS)
16112014 (VIJAY NEWS)16112014 (VIJAY NEWS)
16112014 (VIJAY NEWS)
 
Microsoft office access 2003
Microsoft office access 2003Microsoft office access 2003
Microsoft office access 2003
 

Similar to Q

Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4
DEVCON
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
Johannes Brodwall
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
DEVCON
 
JavaExamples
JavaExamplesJavaExamples
JavaExamples
Suman Astani
 
Phactory
PhactoryPhactory
Phactory
chriskite
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
Alexandre Morgaut
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
Siarzh Miadzvedzeu
 
Iron python
Iron pythonIron python
Iron python
GeorgeIshak
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
Zianed Hou
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
elizhender
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
Washington Botelho
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
Ali Parmaksiz
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
Aren Zomorodian
 
Hibernate
Hibernate Hibernate
Hibernate
Sunil OS
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
Ludmila Nesvitiy
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
ananelson
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
MongoDB
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 
Lecture17
Lecture17Lecture17
Lecture17
vantinhkhuc
 

Similar to Q (20)

Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
 
JavaExamples
JavaExamplesJavaExamples
JavaExamples
 
Phactory
PhactoryPhactory
Phactory
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Iron python
Iron pythonIron python
Iron python
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
Hibernate
Hibernate Hibernate
Hibernate
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Lecture17
Lecture17Lecture17
Lecture17
 

Q

  • 1. 1 Koneksi php: <? $j = $_POST["j"]; $p = $_POST["p"]; $c= mysql_connect("localhost","root",""); mysql_select_db("mobile",$c); $sql= "insert into `buku`(judul, penulis) values('$j','$p')"; if($run=mysql_query($sql,$c)) { echo "ok <br>"; echo "Judul Buku :".$j."<br>"; echo "Penulis : ".$p."<br>"; } else { echo mysql_error(); } ?> Kirim data ke server : import java.io.*; import javax.microedition.io.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class SendData extends MIDlet implements CommandListener { Form f1, f2; TextField Judul,Penulis; Command submit, back; StringItem si; Display tampilan; public SendData(){ f1 = new Form("HTTP Connection");//judul form1 Judul = new TextField ("Judul","",40,TextField.ANY); Penulis = new TextField ("Penulis","",40,TextField.ANY); submit = new Command("Submit",Command.OK,1); //new command("label",jenis, prioritas) f1.append(Judul);//aktifkan fungsi form input f1.append(Penulis); f1.addCommand(submit); f1.setCommandListener(this); f2 = new Form(""); back=new Command("back",Command.BACK,1) ; si=new StringItem("Respon Server","",1); f2.append(si); f2.setCommandListener(this); } public void submit(){ InputStream in = null; String url="http://localhost/koneksi.php"; HttpConnection c=null; OutputStream out = null; try{ c = (HttpConnection)Connector.open(url); c.setRequestMethod(HttpConnection.P OST); c.setRequestProperty("Content- Type","application/x-www-form- urlencoded"); out=c.openOutputStream(); byte data[]; data=("j="+Judul.getString()).getBytes (); out.write(data); data=("&p="+Penulis.getString()).getB ytes(); out.write(data); out.flush(); in=c.openInputStream(); StringBuffer buff= new StringBuffer(); int i; while((i=in.read())!=-1) { if (i!='n') buff.append((char)i); else { si.setText(buff.toString()); buff.delete(0,buff.length()); } } si.setText(si.getText()+buff.toString()); tampilan.setCurrent(f2); } catch(IOException e){ } } public void kembali(){ tampilan.setCurrent(f1); } public void startApp() { tampilan=Display.getDisplay(this); tampilan.setCurrent(f1); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { //throw new UnsupportedOperationException("Not supported yet."); if(c.equals(submit)) { submit(); } else { if(c.equals(back)) { kembali(); } } } } User interface n comnand listener : Class display ; Display Tampilan; Tampilan.getdisplay(this) Tampilan setCurrent(displayable next) Form f; F = newform (“judul form”); Text field; Command exit Exit= new command(“label”,jenisurutan) Tampil gambar : Class tampil gambar extend midlet(){ Form f; Display d; Public tampil Gambar () { F = new form (“tampil gambar”) Try{ Image gbr=new image(“h.jpg”); f.append(gbr); } Catch (io exception e) { } } Web server Test.php Text box tb Tb=new Textbox(“judul”,”isi”, panjang,jenis); Tb.addcommand Tb.set commandListener; StreamConection C; C=(StreamConnection) connector.open(url); http connection.con = null; data InputStream in = null; String URL = “.....”; Try{ Con = (http connection) connector.open(url); Int panjang = (int) con.getLenght(); Byte[] buff = null; If ( panjang = -1) { Buff= new byte[panjang] // bikin buffer In =new Data Input Stream(con) In.read Fully(buff); }
  • 2. 2 Membuat record store: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import javax.microedition.rms.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class newDatabaseRMS extends MIDletimplements CommandListener{ private Display display; private Command createcmd = new Command ("buat", Command.OK,1); private Command exitCmd = new Command("keluar", Command.EXIT,2); private Form f; private TextField t; private RecordStore myDb; private Ticker tck; public newDatabaseRMS(){ } } /** * @author 1945 */ public class recordstore extends MIDlet { public void startApp() { display = Display.getDisplay(this); f = new Form("pemrograman RMS"); t = new TextField("nama Record Store",null,32,TextField.ANY); tck = new Ticker(""); f.append(t); f.addCommand(createCmd); f.addCommand(exitCmd); f.addCommandListener(this); f.setTicker(tck); display.setCurrent(f); } public void buat Db(){ try{ myDb = RecordStore.openRecordStore(t.getStri ng(), true); tck.setString ("Database" + t.getString() + "berhasil di buat"); display.setCurrent(f); }catch (RecordStoreException e ){ tck.setString ("ada kesalahan pembuatan database"); display.setCurrent(f); } } public void keluar(){ this.destroyApp(true); } public void CommandAction (Command c, Displayable d){ String[b] = c.getLabel(); if (lbl.equals("keluar")){ keluar(); }else if (lbl.equals("but")){ butDb(); } } public void pauseApp() { //do Nothing } public void destroyApp(boolean unconditional) { notifyDestroyed(); } }