look at TextField#getText / setText ie: user1 = username.getText()
On Friday, March 24, 2017 at 4:56:50 AM UTC-7, TheHyng wrote:
>
> If you are experiencing an issue please mention the full platform your
> issue applies to:
> IDE: NetBeans/Eclipse/IDEA
> Desktop OS
> Simulator
> Device
>
> Hello, I've created a button called "login" and added an actionlistener
> for when its clicked, but above that I have 2 textfields, the password and
> the username, how do I add the text input from username and password to the
> actual variables and verify it?
>
> 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);
>
> There is no actual Login system going on, on background
>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/d0ddb1c0-20c6-4018-a336-b2777b9756f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.