Search in sources :

Example 46 with DocumentListener

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;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) DocumentEvent(javax.swing.event.DocumentEvent)

Example 47 with DocumentListener

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));
}
Also used : DocumentListener(javax.swing.event.DocumentListener) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) JBLabel(com.intellij.ui.components.JBLabel) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) DocumentEvent(javax.swing.event.DocumentEvent)

Example 48 with DocumentListener

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;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ZapTextField(org.zaproxy.zap.utils.ZapTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Example 49 with DocumentListener

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;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ZapTextField(org.zaproxy.zap.utils.ZapTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Example 50 with DocumentListener

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;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ZapTextField(org.zaproxy.zap.utils.ZapTextField) DocumentEvent(javax.swing.event.DocumentEvent)

Aggregations

DocumentListener (javax.swing.event.DocumentListener)73 DocumentEvent (javax.swing.event.DocumentEvent)70 JTextField (javax.swing.JTextField)24 ActionEvent (java.awt.event.ActionEvent)21 ActionListener (java.awt.event.ActionListener)19 JLabel (javax.swing.JLabel)19 JPanel (javax.swing.JPanel)18 Dimension (java.awt.Dimension)16 JButton (javax.swing.JButton)13 JCheckBox (javax.swing.JCheckBox)13 GridBagLayout (java.awt.GridBagLayout)9 ChangeEvent (javax.swing.event.ChangeEvent)9 GridBagConstraints (java.awt.GridBagConstraints)8 Box (javax.swing.Box)8 ChangeListener (javax.swing.event.ChangeListener)8 BoxLayout (javax.swing.BoxLayout)7 ZapTextField (org.zaproxy.zap.utils.ZapTextField)7 BorderLayout (java.awt.BorderLayout)6 Insets (java.awt.Insets)6 FocusEvent (java.awt.event.FocusEvent)6