use of javax.swing.event.DocumentListener in project intellij-community by JetBrains.
the class SelectLocationDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JPanel browserPanel = new JPanel();
browserPanel.setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
gc.insets = JBUI.insets(2);
gc.gridwidth = 2;
gc.gridheight = 1;
gc.gridx = 0;
gc.gridy = 0;
gc.anchor = GridBagConstraints.WEST;
gc.fill = GridBagConstraints.BOTH;
gc.weightx = 1;
gc.weighty = 1;
myRepositoryBrowser = new RepositoryBrowserComponent(SvnVcs.getInstance(myProject));
browserPanel.add(myRepositoryBrowser, gc);
if (myDstName != null) {
gc.gridy += 1;
gc.gridwidth = 1;
gc.gridx = 0;
gc.fill = GridBagConstraints.NONE;
gc.weightx = 0;
gc.weighty = 0;
JLabel dstLabel = new JLabel(myDstLabel);
browserPanel.add(dstLabel, gc);
gc.gridx += 1;
gc.weightx = 1;
gc.fill = GridBagConstraints.HORIZONTAL;
myDstText = new JTextField();
myDstText.setText(myDstName);
myDstText.selectAll();
browserPanel.add(myDstText, gc);
myDstText.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
getOKAction().setEnabled(isOKActionEnabled());
}
public void removeUpdate(DocumentEvent e) {
getOKAction().setEnabled(isOKActionEnabled());
}
public void changedUpdate(DocumentEvent e) {
getOKAction().setEnabled(isOKActionEnabled());
}
});
dstLabel.setLabelFor(myDstText);
gc.gridx = 0;
gc.gridy += 1;
gc.gridwidth = 2;
browserPanel.add(new JSeparator(), gc);
}
if (myAllowActions) {
panel.add(createToolbar(), BorderLayout.NORTH);
}
panel.add(browserPanel, BorderLayout.CENTER);
return panel;
}
use of javax.swing.event.DocumentListener in project intellij-community by JetBrains.
the class IdeaGradleSystemSettingsControlBuilder method addServiceDirectoryControl.
private void addServiceDirectoryControl(PaintAwarePanel canvas, int indentLevel) {
if (dropServiceDirectory)
return;
myServiceDirectoryLabel = new JBLabel(GradleBundle.message("gradle.settings.text.service.dir.path"));
myServiceDirectoryPathField = new TextFieldWithBrowseButton();
myServiceDirectoryPathField.addBrowseFolderListener("", GradleBundle.message("gradle.settings.title.service.dir.path"), null, new FileChooserDescriptor(false, true, false, false, false, false), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myServiceDirectoryPathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
myServiceDirectoryPathModifiedByUser = true;
myServiceDirectoryPathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
}
@Override
public void removeUpdate(DocumentEvent e) {
myServiceDirectoryPathModifiedByUser = true;
myServiceDirectoryPathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
}
@Override
public void changedUpdate(DocumentEvent e) {
}
});
canvas.add(myServiceDirectoryLabel, ExternalSystemUiUtil.getLabelConstraints(indentLevel));
canvas.add(myServiceDirectoryPathField, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
}
use of javax.swing.event.DocumentListener in project zaproxy by zaproxy.
the class ExcludedParameterAddDialog method getNameTextField.
protected ZapTextField getNameTextField() {
if (nameTextField == null) {
nameTextField = new ZapTextField(25);
nameTextField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void insertUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
private void checkAndEnableConfirmButton() {
setConfirmButtonEnabled(getNameTextField().getDocument().getLength() > 0);
}
});
}
return nameTextField;
}
use of javax.swing.event.DocumentListener in project zaproxy by zaproxy.
the class DialogAddToken method getNameTextField.
protected ZapTextField getNameTextField() {
if (nameTextField == null) {
nameTextField = new ZapTextField(25);
nameTextField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void insertUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
private void checkAndEnableConfirmButton() {
setConfirmButtonEnabled(getNameTextField().getDocument().getLength() > 0);
}
});
}
return nameTextField;
}
use of javax.swing.event.DocumentListener in project zaproxy by zaproxy.
the class DialogAddToken method getNameTextField.
protected ZapTextField getNameTextField() {
if (nameTextField == null) {
nameTextField = new ZapTextField(25);
nameTextField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void insertUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
private void checkAndEnableConfirmButton() {
setConfirmButtonEnabled(getNameTextField().getDocument().getLength() > 0);
}
});
}
return nameTextField;
}
Aggregations