Eclipse密码字段编辑器

3

我有一个偏好设置页面,其中包含一些StringFieldEditor来保存不同的值。其中一个用于密码。我希望密码显示为星号或其他特殊字符。我必须仅使用org.eclipse.jface.preference.FieldEditor或其任何子类。请建议我如何实现这一点。

2个回答

4
password = new StringFieldEditor("passwd", "Password", getFieldEditorParent()) {

@Override
    protected void doFillIntoGrid(Composite parent, int numColumns) {
        super.doFillIntoGrid(parent, numColumns);

        getTextControl().setEchoChar('*');
    }

};

1
StringFieldEditor passwordField = new StringFieldEditor("password", "Password", getFieldEditorParent());
passwordField.getTextControl(getFieldEditorParent()).setEchoChar('*');

addField(passwordField);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接