String user1 = null, pass1 = null;
Form login = new Form("Login");
setBackCommand(login);
TextField username = new TextField("","Username", 20, TextField.INITIAL_CAPS_WORD);
TextField password = new TextField("", "Password", 20, TextField.PASSWORD);
Button userlogin = new Button("Login");
userlogin.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt){
if (user1==null && pass1==null)
Dialog.show("Warning!", "Please, fill all the ", "Ok","Cancel");
else
//How do I add the textfield content to the variables user1 and pass1?
Dialog.show("Logged in!", "Log in successful! ", "Ok", "Close Dialog");
}
});
login.addComponent(username);
login.addComponent(password);
login.addComponent(userlogin);