gbc.weightx = 1.0;
UIUtil.gridBagAdd(p, password, gbc, GridBagConstraints.REMAINDER);
password.requestFocus();
password.setEchoChar('*');
final OptionDialog dialog = new OptionDialog(OptionDialog.QUESTION, p, OptionDialog.CHOICES_OK_CANCEL, null);
username.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dialog.choice(OptionDialog.CHOICE_OK);
}
});
password.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dialog.choice(OptionDialog.CHOICE_OK);
}
});
if (domain != null) {
domain.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
dialog.choice(OptionDialog.CHOICE_OK);
}
});
}
if (dialog.dialogPrompt(null, Messages.getString("AuthenticationDialog.title")) == OptionDialog.CHOICE_OK) { //$NON-NLS-1$
authenticator.setCredentials(new PasswordCredentials(username.getText().trim(), password.getText()));
if (authenticator instanceof NTLMAuthentication && !domain.getText().trim().equals("")) { //$NON-NLS-1$
((NTLMAuthentication) authenticator).setDomain(domain.getText().trim());
}
return true;