How to set a password for G4P gui builder

edited January 2017 in Library Questions

I've got the password box but how do I set it so when the password is correct it does what I ask it to do. For example: If the password is correct, change the background color. Something like that

Answers

  • Use getText() to get the password entered into the password control and compare it to the actual password e.g.

    if(pwf. getText (). equals("actual password ") {
      // password accepted
    } 
    
  • You'll also need to add some sort of submit button, otherwise it may keep checking continuously.

  • edited February 2017

    Hello.

    I'm in the same situation than @nickoesx in this other thread.

    I don't know if it's ok to bring this other thread here... but since nobody asked him, it's about the same control and, in a way, it's related to this question... well, I did it ;;).

    Clearly, this option:

    using a textfield could do: textfield1.setText (""); but in password does not work as

    is not viable at all.

    Is there a way to "clear" de password field?

    Thanks in advance.

    Javier

    PS: I'm using P-3.2.3 and G4P-4.2.

Sign In or Register to comment.