Post

2 followers Follow
0
Avatar

Replace StringOption texts with '*'

Hi,

I am using StringOptions as one of the fields for password input for a plugin, is there anyways to replace the inputs with '*' in the GUI?

Thanks,

Mark

Mark Miller

Please sign in to leave a comment.

2 comments

0
Avatar

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());
}
}
Richard Moir 0 votes
Comment actions Permalink