lunes, 13 de febrero de 2012

Actividad 7

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package tarjeta;

import javax.microedition.midlet.*;

/**

* @author victor

*/

import javax.microedition.lcdui.*;

import javax.microedition.midlet.MIDlet;

public class tarjeta extends MIDlet implements CommandListener {

private Display display;

private Command salir;

private Canvas micanvas;

//Constructor

public tarjeta(){

//Cogemos el display

display=Display.getDisplay(this);

//Creamos la pantalla principal

micanvas = new Canvas(){

private int width;

private int height;

public void paint (Graphics g){

width=getWidth();

height=getHeight();

//pintamos la pantalla de negro

g.setColor(73,48,60);

g.fillRect(0,0,width,height);

//Leemos una imagen desde un fichero y la mostramos

try{

Image imagen=Image.createImage("/logo.jpg");

g.drawImage(imagen,width/2,height/2,(Graphics.VCENTER | Graphics.HCENTER));

g.setColor(255,255,255);

//g.setStrokeStyle(Graphics.SOLID);

g.drawString("Victor Barrera Tec",5,10,(Graphics.BASELINE | Graphics.LEFT));

g.drawString("victor_max12@hotmail.com.",5,25,(Graphics.BASELINE | Graphics.LEFT));

} catch (java.io.IOException e) {

g.setColor(255,255,255);

g.setStrokeStyle(Graphics.SOLID);

g.drawString("Fallo al leer logo.jpg",0,height/2,(Graphics.BASELINE | Graphics.LEFT));

}

}//fin de metodo paint

};

//Creamos el comando salir

salir=new Command("Salir",Command.EXIT,3);

//aadimos el comando al Canvas y activamos el oyente

micanvas.addCommand(salir);

micanvas.setCommandListener(this);

}

//Metodo que se llama cuando pasamos de Pausado a Activo

protected void startApp( ) {

display.setCurrent(micanvas);

}

//Metodo que se llama cuando pasamos de Activo a Pausado

protected void pauseApp( ) {

}

//Metodo que se llama cuando se destruye el midlet

protected void destroyApp(boolean incondicional) {

}

//Metodo para el tratamiento de datos de teclado

public void commandAction(Command c,Displayable d) {

//Miramos si nos salimos o mostramos la alerta

if(c==salir){

destroyApp(true);

notifyDestroyed();

}else System.out.println("Otro comando pulsado");

}

}




sábado, 11 de febrero de 2012

Actividad 6



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hello;

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

/**
* @author cinthia
*/
public class HelloMIDlet extends MIDlet implements CommandListener {
private boolean midletPaused = false;
//
private Command exitCommand;
private Form form;
private StringItem stringItem;
//

/**
* The HelloMIDlet constructor.
*/
public HelloMIDlet() {
}

//
//
//
/**
* Initializes the application. It is called only once when the MIDlet is
* started. The method is called before the
* startMIDlet method.
*/
private void initialize() {
// write pre-initialize user code here
// write post-initialize user code here
}
//

//
/**
* Performs an action assigned to the Mobile Device - MIDlet Started point.
*/
public void startMIDlet() {
// write pre-action user code here
switchDisplayable(null, getForm());
// write post-action user code here
}
//

//
/**
* Performs an action assigned to the Mobile Device - MIDlet Resumed point.
*/
public void resumeMIDlet() {
// write pre-action user code here
// write post-action user code here
}
//

//
/**
* Switches a current displayable in a display. The
* display instance is taken from
* getDisplay method. This method is used by all actions in the
* design for switching displayable.
*
* @param alert the Alert which is temporarily set to the display; if
* null, then
* nextDisplayable is set immediately
* @param nextDisplayable the Displayable to be set
*/
public void switchDisplayable(Alert alert, Displayable nextDisplayable) {
// write pre-switch user code here
Display display = getDisplay();
if (alert == null) {
display.setCurrent(nextDisplayable);
} else {
display.setCurrent(alert, nextDisplayable);
}
// write post-switch user code here
}
//

//
/**
* Called by a system to indicated that a command has been invoked on a
* particular displayable.
*
* @param command the Command that was invoked
* @param displayable the Displayable where the command was invoked
*/
public void commandAction(Command command, Displayable displayable) {
// write pre-action user code here
if (displayable == form) {
if (command == exitCommand) {
// write pre-action user code here
exitMIDlet();
// write post-action user code here
}
}
// write post-action user code here
}
//

//
/**
* Returns an initialized instance of exitCommand component.
*
* @return the initialized component instance
*/
public Command getExitCommand() {
if (exitCommand == null) {
// write pre-init user code here
exitCommand = new Command("Exit", Command.EXIT, 0);
// write post-init user code here
}
return exitCommand;
}
//

//
/**
* Returns an initialized instance of form component.
*
* @return the initialized component instance
*/
public Form getForm() {
if (form == null) {
// write pre-init user code here
form = new Form("Bienvenido", new Item[]{getStringItem()});
form.addCommand(getExitCommand());
form.setCommandListener(this);
// write post-init user code here
}
return form;
}
//

//
/**
* Returns an initialized instance of stringItem component.
*
* @return the initialized component instance
*/
public StringItem getStringItem() {
if (stringItem == null) {
// write pre-init user code here
stringItem = new StringItem("Hola", "Mi nombre es Victor Barrera Tec");
// write post-init user code here
}
return stringItem;
}
//

/**
* Returns a display instance.
*
* @return the display instance.
*/
public Display getDisplay() {
return Display.getDisplay(this);
}

/**
* Exits MIDlet.
*/
public void exitMIDlet() {
switchDisplayable(null, null);
destroyApp(true);
notifyDestroyed();
}

/**
* Called when MIDlet is started. Checks whether the MIDlet have been
* already started and initialize/starts or resumes the MIDlet.
*/
public void startApp() {
if (midletPaused) {
resumeMIDlet();
} else {
initialize();
startMIDlet();
}
midletPaused = false;
}

/**
* Called when MIDlet is paused.
*/
public void pauseApp() {
midletPaused = true;
}

/**
* Called to signal the MIDlet to terminate.
*
* @param unconditional if true, then the MIDlet has to be unconditionally
* terminated and all resources has to be released.
*/
public void destroyApp(boolean unconditional) {
}
}


martes, 7 de febrero de 2012

Reparacion de la actividad 4

Este es link de la actividad 4 y pues lo intente reparar y pues namas pude conectar la base de datos pero las funciones que son el agregar y actualizar no me funcionan. No se porque este pasando esto porque de forma local hice las pruebas y todo funciona pero al subirlo no pude realizar estas funciones. De todas formas estare preguntando para entregarlo completo.

Actividad 5


SonyEricsson

K310a





MIDP: 2.0
CLDC: 1.1
Platform: SonyEricssonK310a/R4DA044
Java Canvas Size: 128 x 128 pixels
Java Fullscreen Canvas Size: 128 x 160 pixels

lunes, 6 de febrero de 2012


link de la actividad 4



este es el link de la actividad 4 y mas que la verdad trate de crear la base da datos pero no pude hacerlo correr con mi trabajo pero en mi maquina todo funciona y pues este link es para hacerle saber que trate de realizar el trabajo completo pero no pude...