Skip to main content

Passwordoption

Comments

1 comment

  • Tom Edwards

    Hi Brian,

    The Password Option is one of our custom options, you can add it to any class which extends Options with the method addCustomOption(...).

    For example:

    PasswordOption passwordOption = addCustomOption(new PasswordOption("myPassword", "Password:", true));

    The last parameter of the PasswordOption (which is 'true' in my example) is for whether you want the password to be automatically remembered and filled between sessions. If this is true, then a user will have a checkbox to save (an encrypted version of) the password to their data directory whenever they press 'OK'

    If you want to get the current value of the password and use it in your code you can call this method:

    String passwordCurrentlyEntered = passwordOption.getPassword();// The password currently entered

    Or, another way of getting the password:

    // This can be used from outside the class, but you will need to replace 'this' with the options object
    PasswordOption myPasswordOption = (PasswordOption) this.getOption("myPassword");
    String passwordCurrentlyEntered2 = myPasswordOption.getPassword();

     

    I hope that answers your question, but if you have anymore questions about how to set up your options, feel free to ask.

    Cheers,

    Tom

    0

Please sign in to leave a comment.