Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- public class Midlet extends MIDlet implements CommandListener
- {
- private Display display;
- private Form form;
- private Command logar, exit;
- private TextField usuario, senha;
- public Midlet() {
- display = Display.getDisplay(this);
- form = new Form("Efetue seu Login");
- logar = new Command("Login", Command.SCREEN, 1);
- exit = new Command("Sair", Command.EXIT, 1);
- usuario = new TextField("Login:", "", 30, TextField.ANY);
- senha = new TextField("Senha:", "", 30, TextField.PASSWORD);
- form.addCommand(exit);
- form.addCommand(logar);
- form.append(usuario);
- form.append(senha);
- form.setCommandListener(this);
- }
- public void startApp()
- {
- display.setCurrent(form);
- }
- public void pauseApp(){}
- public void destroyApp(boolean unconditional)
- {
- notifyDestroyed();
- }
- public void commandAction(Command c, Displayable s)
- {
- String label = c.getLabel();
- if (label.equals("Login"))
- {
- if (usuario.getString().equals("ipsBruno") && senha.getString().equals("123"))
- {
- form.append("Parabens voce foi logado com sucesso!");
- }
- else
- {
- form.append("Voce errou a senha tente novamente");
- }
- }
- else if (label.equals("Sair"))
- {
- destroyApp(false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement