Cadastrotelefone

313 palavras 2 páginas
/* * To change this template, choose Tools | Templates * and open the template in the editor. */

import java.util.Date; import javax.microedition.lcdui.*; import javax.microedition.midlet.*;

/** * @author alunoead */ public class Cadastro extends MIDlet implements CommandListener { //1. Declarar os componentes gráficos

private Display display; private Form frmCadastro; private DateField dtNascimento; private TextField txtNome, txtTelefone; private ChoiceGroup cgSexo; private Ticker letreiro; private Command cmdVoltar; private Command cmdGravar; private Command cmdNovo; private Command cmdListar; private Command cmdVoltarCadastro; private List lista;

public void startApp() { //2. inicializar os componentes display = Display.getDisplay(this); frmCadastro = new Form("Cadastro");

txtNome = new TextField("Nome", null, 30, TextField.ANY); txtTelefone = new TextField("Telefone", null, 15, TextField.PHONENUMBER); dtNascimento = new DateField("Data", DateField.DATE); dtNascimento.setDate(new Date());

cgSexo = new ChoiceGroup("Sexo", ChoiceGroup.POPUP); cgSexo.append("Fem", null); cgSexo.append("Masc", null); letreiro = new Ticker("Agenda de Contatos"); lista = new List("Lista de Contatos", List.EXCLUSIVE); //3. Inicializar os comandos

cmdVoltar = new Command("Voltar", Command.BACK, 1); cmdNovo = new Command("Novo", Command.ITEM, 1); cmdGravar = new Command("Gravar", Command.ITEM, 1); cmdListar = new Command("Listar", Command.ITEM, 1); cmdVoltarCadastro = new Command("Voltar Cadastro", Command.BACK, 1);

//4. Adicionar os componentes ao Formulário frmCadastro.append(txtNome); frmCadastro.append(txtTelefone); frmCadastro.append(dtNascimento);

Relacionados