我正在开发一个eclipse插件。其中,第一页将是身份验证页面。
为此编写的代码是
this.urlLabel = new Label(loginPanel, SWT.NONE);
this.urlLabel.setText("Server URL");
this.server = new Text(loginPanel, SWT.BORDER);
this.usernameLabel = new Label(loginPanel, SWT.NONE);
this.usernameLabel.setText("Username");
this.username = new Text(loginPanel, SWT.BORDER);
this.passwordLabel = new Label(loginPanel, SWT.NONE);
this.passwordLabel.setText("Password");
this.password = new Text(loginPanel, 4196352);
所以我想要做的是,对于 URL,当我开始输入时,用户名应该建议我使用以前输入的值。怎么做。帮我解决这个问题。
您可以org.eclipse.jface.fieldassist.AutoCompleteField
为此使用。
对于文本控件使用:
new AutoCompleteField(control, new TextContentAdapter(), proposals);
哪里control
是Text
控件(例如您的username
)。
proposals
是一个字符串数组,其中包含您希望自动完成使用的先前值。
您可以调用 的setProposals
方法AutoCompleteField
来更新提案数组。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句