Search in sources :

Example 6 with ItemListener

use of java.awt.event.ItemListener in project intellij-community by JetBrains.

the class RepositoryLibraryPropertiesEditor method initVersionsPanel.

private void initVersionsPanel() {
    final int selection = getSelection(model.getVersion(), versions);
    CollectionComboBoxModel<String> versionSelectorModel = new CollectionComboBoxModel<>(versions);
    //noinspection unchecked
    versionSelector.setModel(versionSelectorModel);
    versionSelector.setSelectedIndex(selection);
    setState(State.Loaded);
    initVersionKindSelector();
    versionSelector.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            model.setVersion(getSelectedVersion());
            onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
        }
    });
    downloadSourcesCheckBox.setSelected(model.isDownloadSources());
    downloadSourcesCheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            model.setDownloadSources(downloadSourcesCheckBox.isSelected());
            onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
        }
    });
    downloadJavaDocsCheckBox.setSelected(model.isDownloadJavaDocs());
    downloadJavaDocsCheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            model.setDownloadJavaDocs(downloadJavaDocsCheckBox.isSelected());
            onChangeListener.onChange(RepositoryLibraryPropertiesEditor.this);
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ChangeEvent(javax.swing.event.ChangeEvent) CollectionComboBoxModel(com.intellij.ui.CollectionComboBoxModel) ItemListener(java.awt.event.ItemListener) ChangeListener(javax.swing.event.ChangeListener)

Example 7 with ItemListener

use of java.awt.event.ItemListener in project intellij-community by JetBrains.

the class SelectMavenProjectDialog method createCenterPanel.

protected JComponent createCenterPanel() {
    ComboBoxUtil.setModel(myMavenProjectsComboBox, new DefaultComboBoxModel(), myMavenDomProjectModels, model -> {
        String projectName = model.getName().getStringValue();
        MavenProject mavenProject = MavenDomUtil.findProject(model);
        if (mavenProject != null) {
            projectName = mavenProject.getDisplayName();
        }
        if (StringUtil.isEmptyOrSpaces(projectName)) {
            projectName = "pom.xml";
        }
        return Pair.create(projectName, model);
    });
    myReplaceAllListener = new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            updateControls();
        }
    };
    myMavenProjectsComboBox.addItemListener(myReplaceAllListener);
    myMavenProjectsComboBox.setSelectedItem(0);
    myReplaceAllCheckBox.setVisible(myHasUsagesInProjects);
    myExtractExclusions.setVisible(myHasExclusions);
    updateControls();
    return myMainPanel;
}
Also used : ItemEvent(java.awt.event.ItemEvent) MavenProject(org.jetbrains.idea.maven.project.MavenProject) ItemListener(java.awt.event.ItemListener)

Example 8 with ItemListener

use of java.awt.event.ItemListener in project intellij-community by JetBrains.

the class EvalExpressionDialog method init.

protected void init() {
    final ToolWindow findWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.FIND);
    final boolean available = findWindow != null && findWindow.isAvailable();
    myForm.getNewTabCheckbox().setEnabled(available);
    myForm.getNewTabCheckbox().setSelected(FindSettings.getInstance().isShowResultsInSeparateView());
    myForm.getHighlightCheckbox().setSelected(mySettings.HIGHLIGHT_RESULTS);
    myForm.getHighlightCheckbox().addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            updateOkAction();
        }
    });
    myForm.getUsageViewCheckbox().setSelected(mySettings.SHOW_USAGE_VIEW);
    myForm.getUsageViewCheckbox().addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            myForm.getNewTabCheckbox().setEnabled(available && myForm.getUsageViewCheckbox().isSelected());
            updateOkAction();
        }
    });
    super.init();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 9 with ItemListener

use of java.awt.event.ItemListener in project intellij-community by JetBrains.

the class AddNamespaceDialog method addUpdateListener.

private void addUpdateListener(ComboBox comboBox) {
    final ComboBoxEditor boxEditor = comboBox.getEditor();
    if (boxEditor != null) {
        final Component component = boxEditor.getEditorComponent();
        if (component instanceof JTextField) {
            ((JTextField) component).getDocument().addDocumentListener(new DocumentAdapter() {

                protected void textChanged(DocumentEvent e) {
                    updateOkAction();
                }
            });
        }
    }
    comboBox.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            updateOkAction();
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) DocumentAdapter(com.intellij.ui.DocumentAdapter) ItemListener(java.awt.event.ItemListener) DocumentEvent(javax.swing.event.DocumentEvent)

Example 10 with ItemListener

use of java.awt.event.ItemListener in project zaproxy by zaproxy.

the class SpiderPanel method getShowMessagesToggleButton.

private JToggleButton getShowMessagesToggleButton() {
    if (showMessageToggleButton == null) {
        showMessageToggleButton = new JToggleButton(Constant.messages.getString("spider.toolbar.button.showmessages.label"), new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/178.png")));
        showMessageToggleButton.setToolTipText(Constant.messages.getString("spider.toolbar.button.showmessages.tooltip"));
        showMessageToggleButton.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                if (ItemEvent.SELECTED == e.getStateChange()) {
                    showTabs();
                } else {
                    hideMessagesTab();
                }
            }
        });
    }
    return showMessageToggleButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) ItemEvent(java.awt.event.ItemEvent) JToggleButton(javax.swing.JToggleButton) ItemListener(java.awt.event.ItemListener)

Aggregations

ItemListener (java.awt.event.ItemListener)331 ItemEvent (java.awt.event.ItemEvent)314 ActionEvent (java.awt.event.ActionEvent)111 ActionListener (java.awt.event.ActionListener)108 JPanel (javax.swing.JPanel)93 JLabel (javax.swing.JLabel)81 JCheckBox (javax.swing.JCheckBox)65 JComboBox (javax.swing.JComboBox)64 JButton (javax.swing.JButton)51 Dimension (java.awt.Dimension)50 BorderLayout (java.awt.BorderLayout)47 JTextField (javax.swing.JTextField)46 ButtonGroup (javax.swing.ButtonGroup)34 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)33 GridBagConstraints (java.awt.GridBagConstraints)29 JMenu (javax.swing.JMenu)29 ChangeEvent (javax.swing.event.ChangeEvent)29 GridBagLayout (java.awt.GridBagLayout)28 JMenuItem (javax.swing.JMenuItem)28 ChangeListener (javax.swing.event.ChangeListener)28