Aplicacion para celulares

Solo disponible en BuenasTareas
  • Páginas : 2 (356 palabras )
  • Descarga(s) : 7
  • Publicado : 29 de agosto de 2009
Leer documento completo
Vista previa del texto
package Ec3g;

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Ec3g extends MIDlet implements CommandListener {
privateForm pan;
private Command calcular,salir;
private TextField a,b,e,d;
private Display dis;
private Image[]imag=new Image[2];
private Ticker t;
private StringItemnn;
private int i;
private double xn=-3,raiz,X1,X2,X3,fort,corta;


public Ec3g() {
dis=Display.getDisplay(this);

try {
imag[1] = Image.createImage("/Ec3g/Ec3g.PNG" );
} catch( IOException e ){}
pan=new Form("Ax^3+Bx^2+Cx+D=0");
a=new TextField("A=","",8,TextField.DECIMAL);
b=new TextField("B=","",8,TextField.DECIMAL);e=new TextField("C=","",8,TextField.DECIMAL);
d=new TextField("D=","",8,TextField.DECIMAL);
//x1=new TextField("X1=","",64,TextField.ANY);
//x2=newTextField("X2=","",64,TextField.ANY);
//x3=new TextField("X3=","",64,TextField.ANY);

nn=new StringItem("SOLUCION","",1);
t =new Ticker("PROGRAMA HECHO POR SELF");

salir=new Command("Salir",Command.EXIT,1);calcular=new Command("Calcular",Command.BACK,1);

pan.append(a);
pan.append(b);
pan.append(e);
pan.append(d);
pan.append(nn);
//pan.append(x1);
//pan.append(x2);//pan.append(x3);
pan.setTicker(t);
pan.addCommand(salir);
pan.addCommand(calcular);
pan.setCommandListener(this);
}

protected void destroyApp(boolean incondicional){
// TODOAuto-generated method stub

}

protected void pauseApp() {
// TODO Auto-generated method stub

}

protected void startApp(){
dis.setCurrent(pan);

}

public voidcommandAction(Command c,Displayable d){
if(c==salir){
destroyApp(false);
notifyDestroyed();
}
if(c==calcular){
llamar_calculo();
if(fort>=0){
Alert solu=new Alert("SOLUCIÓN...
tracking img