Ciao; allora da quanto so, la J2ME non permette di gestire dei db; in pratica non puoi pensare di installare MySql o Oracle o SqlServer su di un palmare o cellulare.
Devi fare tutto su di un server; creare una web application e poi connetterti ad essa dal cellulare/palmare; per i pulsanti etc... utilizza gli oggetti lcdui o simile; ad esempio ti posto il codice di una Form per cellulare che io ho creato:
Codice PHP:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class FormBookInsert extends Form implements CommandListener {
TextField autore;
TextField titolo;
Command exit = new Command("Exit", Command.EXIT, 1);
Command insert = new Command( "Inserisci", Command.OK, 2 );
private GestioneLibri inser;
public FormBookInsert( GestioneLibri inser ) {
super("Inserisci Libro");
this.inser = inser;
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
// Set up this Displayable to listen to command events
autore = new TextField("", "", 15,TextField.INITIAL_CAPS_WORD);
titolo = new TextField("", "", 15,TextField.INITIAL_CAPS_WORD);
titolo.setLabel("Titolo");
titolo.setLayout(Item.LAYOUT_CENTER |Item.LAYOUT_VCENTER |Item.LAYOUT_EXPAND |Item.LAYOUT_VEXPAND);
titolo.setConstraints(TextField.ANY | TextField.INITIAL_CAPS_WORD);
titolo.setMaxSize(150);
autore.setLabel("Autore");
autore.setLayout(Item.LAYOUT_CENTER |Item.LAYOUT_VCENTER |Item.LAYOUT_EXPAND |Item.LAYOUT_VEXPAND);
autore.setConstraints(TextField.ANY | TextField.INITIAL_CAPS_WORD);
autore.setMaxSize(100);
autore.setString("");
setCommandListener(this);
// add the Exit command
addCommand( exit );
addCommand( insert );
this.append(autore);
this.append(titolo);
}
public void commandAction(Command command, Displayable displayable) {
if( ( command == this.insert ) && ( this.autore.getString() != null ) && ( !this.autore.getString().trim().equals( "" ) ) && ( this.titolo.getString() != null ) && ( !this.titolo.getString().trim().equals( "" ) ) ){
doInsert();
}else if ( command == this.exit ){
this.inser.exit();
}
}
private void doInsert(){
InserisciDati inserimento = new InserisciDati();
inserimento.openRecordStore();
inserimento.scriviFlussi( autore.getString(), titolo.getString() );
inserimento.closeRecordStore();
inserimento = null;
System.gc();
}
}
Soero di esserti stato utilie, ciao.