J2me

Disponível somente no TrabalhosFeitos
  • Páginas : 2 (303 palavras )
  • Download(s) : 0
  • Publicado : 4 de março de 2013
Ler documento completo
Amostra do texto
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
importjavax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.TextField;
importjavax.microedition.midlet.MIDlet;

public class Pat extends MIDlet {
private Display tela;
Form form;
private Command sair;
private Command Calcular;
TextField tfRM, tfDisc, tf1tri, tf2tri,tf3tri;
Alert alerta;
public Image img1,img2;




public Pat() {
tela = Display.getDisplay(this);
form = new Form("Campo de Texto");
tfRM = new TextField("RM:", "", 10,TextField.NUMERIC);
tfDisc = new TextField("Disciplina:", "", 10, TextField.ANY);
tf1tri = new TextField("Nota 1:", "", 10, TextField.DECIMAL);
tf2tri = new TextField("Nota 2:", "", 10,TextField.DECIMAL);
tf3tri = new TextField("Nota 3:", "", 10, TextField.DECIMAL);

sair = new Command("Sair", Command.EXIT, 1);
Calcular = new Command("Calcular", Command.OK, 1);form.append(tfRM);
form.append(tfDisc);
form.append(tf1tri);
form.append(tf2tri);
form.append(tf3tri);

form.addCommand(sair);
form.addCommand(Calcular);

form.setCommandListener(newCommandListener () {


public void commandAction(Command c, Displayable d){
if (c == sair)
{
destroyApp(true);

notifyDestroyed();}
try{
img1 = Image.createImage("/reprovado.png");

img2 = Image.createImage("/aprovado.png");
}
catch(Exception e)
{e.printStackTrace();}
if(c== Calcular){
int rm = Integer.parseInt(tfRM.getString());

double nota1 = Double.parseDouble(tf1tri.getString());
double nota2 = Double.parseDouble(tf2tri.getString());...
tracking img