}
});
WidgetUtils.addToGridBag(new JLabel("Username"), proxyAuthPanel, 0, 0);
WidgetUtils.addToGridBag(proxyUsernameField, proxyAuthPanel, 1, 0);
final JPasswordField proxyPasswordField = new JPasswordField(_userPreferences.getProxyPassword());
proxyPasswordField.getDocument().addDocumentListener(new DCDocumentListener() {
@Override
protected void onChange(DocumentEvent event) {
_userPreferences.setProxyPassword(String.valueOf(proxyPasswordField.getPassword()));
}
});
WidgetUtils.addToGridBag(new JLabel("Password"), proxyAuthPanel, 0, 1);
WidgetUtils.addToGridBag(proxyPasswordField, proxyAuthPanel, 1, 1);
WidgetUtils.addToGridBag(proxyAuthCheckBox, proxyPanel, 0, 2, 2, 1);
WidgetUtils.addToGridBag(proxyAuthPanel, proxyPanel, 0, 3, 2, 1);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
proxyHostField.setEnabled(proxyCheckBox.isSelected());
proxyPortField.setEnabled(proxyCheckBox.isSelected());
proxyAuthCheckBox.setEnabled(proxyCheckBox.isSelected());
proxyUsernameField.setEnabled(proxyAuthCheckBox.isSelected() && proxyCheckBox.isSelected());
proxyPasswordField.setEnabled(proxyAuthCheckBox.isSelected() && proxyCheckBox.isSelected());
}
};
proxyCheckBox.addActionListener(actionListener);
proxyAuthCheckBox.addActionListener(actionListener);