Skip to main content

Replace StringOption texts with '*'

Comments

2 comments

  • Richard Moir

    Unfortunately you can't do that with a StringOption directly. The best option is to use JPasswordField as a custom component in your own subclass of Options like this:

     

    class MyOptions extends Options {

    JPasswordField passwordField;

    MyOptions() {
    passwordField = new JPasswordField();
    addCustomComponent(passwordField);
    }

    String getPassword() {
    return new String(passwordField.getPassword());
    }
    }
    0
  • Mark Miller

    It works! Thank you!

    0

Please sign in to leave a comment.