Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java ME - Multiple forms, moving from one screen to the next

I am using Java Micro Edition and I am trying to create a simple login form with a record store. When the user enters the details I'd like to check them against the ones stored and then move onto another screen like a welcome area.

I have a feeling it has something to do with the form element and switching between it but I can't seem to get anywhere with google

like image 291
Garbit Avatar asked Feb 28 '23 11:02

Garbit


1 Answers

try this

form = new Form("login");
form.addCommand(getExitCommand());
form.addCommand(getOkCommand());
form.setCommandListener(this);

public void commandAction(Command command, Displayable displayable) {
    if (displayable == form) {
        if (command == exitCommand) {
            exitMIDlet();
        } else if (command == okCommand) {
            display.setCurrent(getWelcomeForm());
        }
    } else if (displayable == form1) {
        if (command == backCommand) {
            // do something else
        }
    }
}
like image 84
Vivart Avatar answered Apr 27 '23 22:04

Vivart