Search in sources :

Example 16 with ChangeListener

use of javax.swing.event.ChangeListener in project intellij-community by JetBrains.

the class ImportOldConfigsPanel method init.

private void init() {
    MnemonicHelper.init(getContentPane());
    ButtonGroup group = new ButtonGroup();
    group.add(myRbDoNotImport);
    group.add(myRbImport);
    group.add(myRbImportAuto);
    myRbDoNotImport.setSelected(true);
    String productName = mySettings.getProductName(ThreeState.UNSURE);
    mySuggestLabel.setText(mySettings.getTitleLabel(productName));
    myRbDoNotImport.setText(mySettings.getDoNotImportLabel(productName));
    if (myGuessedOldConfig != null) {
        myRbImportAuto.setText(mySettings.getAutoImportLabel(myGuessedOldConfig));
        myRbImportAuto.setSelected(true);
    } else {
        myRbImportAuto.setVisible(false);
    }
    myRbImport.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            update();
        }
    });
    if (myGuessedOldConfig != null) {
        myPrevInstallation.setText(myGuessedOldConfig.getParent());
    } else if (SystemInfo.isMac) {
        myPrevInstallation.setText(findPreviousInstallationMac(productName));
    } else if (SystemInfo.isWindows) {
        String prevInstall = findPreviousInstallationWindows(productName);
        if (prevInstall != null) {
            myPrevInstallation.setText(prevInstall);
        }
    }
    myPrevInstallation.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = myLastSelection != null ? new JFileChooser(myLastSelection) : new JFileChooser();
            fc.setFileSelectionMode(SystemInfo.isMac ? JFileChooser.FILES_AND_DIRECTORIES : JFileChooser.DIRECTORIES_ONLY);
            fc.setFileHidingEnabled(!SystemInfo.isLinux);
            int returnVal = fc.showOpenDialog(ImportOldConfigsPanel.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                if (file != null) {
                    myLastSelection = file;
                    myPrevInstallation.setText(file.getAbsolutePath());
                }
            }
        }
    });
    myOkButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            close();
        }
    });
    CloudConfigProvider configProvider = CloudConfigProvider.getProvider();
    if (configProvider != null) {
        configProvider.initConfigsPanel(group, myCustomButton);
    }
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(myRootPanel);
    getRootPane().setDefaultButton(myOkButton);
    setTitle(ApplicationBundle.message("title.complete.installation"));
    update();
    pack();
    setLocationRelativeTo(null);
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) CloudConfigProvider(com.intellij.ide.cloudConfig.CloudConfigProvider) ChangeListener(javax.swing.event.ChangeListener) File(java.io.File)

Example 17 with ChangeListener

use of javax.swing.event.ChangeListener in project intellij-community by JetBrains.

the class AppearanceConfigurable method createComponent.

@SuppressWarnings("unchecked")
@Override
public JComponent createComponent() {
    UISettings settings = UISettings.getInstance();
    initComponent();
    myComponent.myFontSizeCombo.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
    myComponent.myPresentationModeFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
    myComponent.myFontSizeCombo.setEditable(true);
    myComponent.myPresentationModeFontSize.setEditable(true);
    myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
    myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer());
    myComponent.myAntialiasingInIDE.setModel(new DefaultComboBoxModel(AntialiasingType.values()));
    myComponent.myAntialiasingInEditor.setModel(new DefaultComboBoxModel(AntialiasingType.values()));
    myComponent.myAntialiasingInIDE.setSelectedItem(settings.getIdeAAType());
    myComponent.myAntialiasingInEditor.setSelectedItem(settings.getEditorAAType());
    myComponent.myAntialiasingInIDE.setRenderer(new AAListCellRenderer(false));
    myComponent.myAntialiasingInEditor.setRenderer(new AAListCellRenderer(true));
    @SuppressWarnings("UseOfObsoleteCollectionType") Dictionary<Integer, JComponent> delayDictionary = new Hashtable<>();
    delayDictionary.put(new Integer(0), new JLabel("0"));
    delayDictionary.put(new Integer(1200), new JLabel("1200"));
    //delayDictionary.put(new Integer(2400), new JLabel("2400"));
    myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary);
    UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE);
    myComponent.myInitialTooltipDelaySlider.setMinimum(0);
    myComponent.myInitialTooltipDelaySlider.setMaximum(1200);
    myComponent.myInitialTooltipDelaySlider.setPaintLabels(true);
    myComponent.myInitialTooltipDelaySlider.setPaintTicks(true);
    myComponent.myInitialTooltipDelaySlider.setPaintTrack(true);
    myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200);
    myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100);
    myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected();
            myComponent.myAlphaModeDelayTextField.setEnabled(state);
            myComponent.myAlphaModeRatioSlider.setEnabled(state);
        }
    });
    myComponent.myAlphaModeRatioSlider.setSize(100, 50);
    @SuppressWarnings({ "UseOfObsoleteCollectionType" }) Dictionary<Integer, JComponent> dictionary = new Hashtable<>();
    dictionary.put(new Integer(0), new JLabel("0%"));
    dictionary.put(new Integer(50), new JLabel("50%"));
    dictionary.put(new Integer(100), new JLabel("100%"));
    myComponent.myAlphaModeRatioSlider.setLabelTable(dictionary);
    UIUtil.setSliderIsFilled(myComponent.myAlphaModeRatioSlider, Boolean.TRUE);
    myComponent.myAlphaModeRatioSlider.setPaintLabels(true);
    myComponent.myAlphaModeRatioSlider.setPaintTicks(true);
    myComponent.myAlphaModeRatioSlider.setPaintTrack(true);
    myComponent.myAlphaModeRatioSlider.setMajorTickSpacing(50);
    myComponent.myAlphaModeRatioSlider.setMinorTickSpacing(10);
    myComponent.myAlphaModeRatioSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            myComponent.myAlphaModeRatioSlider.setToolTipText(myComponent.myAlphaModeRatioSlider.getValue() + "%");
        }
    });
    myComponent.myTransparencyPanel.setVisible(WindowManagerEx.getInstanceEx().isAlphaModeSupported());
    return myComponent.myPanel;
}
Also used : Hashtable(java.util.Hashtable) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 18 with ChangeListener

use of javax.swing.event.ChangeListener in project intellij-community by JetBrains.

the class UnnecessaryFinalOnLocalVariableOrParameterInspection method createOptionsPanel.

@Override
@Nullable
public JComponent createOptionsPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final JCheckBox abstractOnlyCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.on.parameter.only.interface.option"), onlyWarnOnAbstractMethods) {

        @Override
        public void setEnabled(boolean b) {
            // inspection settings (otherwise it is always enabled)
            if (b) {
                super.setEnabled(reportParameters);
            } else {
                super.setEnabled(false);
            }
        }
    };
    abstractOnlyCheckBox.setEnabled(true);
    abstractOnlyCheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            onlyWarnOnAbstractMethods = abstractOnlyCheckBox.isSelected();
        }
    });
    final JCheckBox reportLocalVariablesCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.report.local.variables.option"), reportLocalVariables);
    final JCheckBox reportParametersCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.report.parameters.option"), reportParameters);
    reportLocalVariablesCheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            reportLocalVariables = reportLocalVariablesCheckBox.isSelected();
            if (!reportLocalVariables) {
                reportParametersCheckBox.setSelected(true);
            }
        }
    });
    reportParametersCheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            reportParameters = reportParametersCheckBox.isSelected();
            if (!reportParameters) {
                reportLocalVariablesCheckBox.setSelected(true);
            }
            abstractOnlyCheckBox.setEnabled(reportParameters);
        }
    });
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    panel.add(reportLocalVariablesCheckBox, constraints);
    constraints.gridy = 1;
    panel.add(reportParametersCheckBox, constraints);
    constraints.insets.left = 20;
    constraints.gridy = 2;
    constraints.weighty = 1.0;
    panel.add(abstractOnlyCheckBox, constraints);
    return panel;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) Nullable(org.jetbrains.annotations.Nullable)

Example 19 with ChangeListener

use of javax.swing.event.ChangeListener in project intellij-community by JetBrains.

the class IdeErrorsDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    DefaultActionGroup goBack = new DefaultActionGroup();
    BackAction back = new BackAction();
    goBack.add(back);
    ActionToolbar backToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, goBack, true);
    backToolbar.getComponent().setBorder(IdeBorderFactory.createEmptyBorder());
    backToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
    myBackButtonPanel.add(backToolbar.getComponent(), BorderLayout.CENTER);
    DefaultActionGroup goForward = new DefaultActionGroup();
    ForwardAction forward = new ForwardAction();
    goForward.add(forward);
    ActionToolbar forwardToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, goForward, true);
    forwardToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
    forwardToolbar.getComponent().setBorder(IdeBorderFactory.createEmptyBorder());
    myNextButtonPanel.add(forwardToolbar.getComponent(), BorderLayout.CENTER);
    myTabs = new HeaderlessTabbedPane(getDisposable());
    final LabeledTextComponent.TextListener commentsListener = new LabeledTextComponent.TextListener() {

        @Override
        public void textChanged(String newText) {
            if (myMute) {
                return;
            }
            AbstractMessage message = getSelectedMessage();
            if (message != null) {
                message.setAdditionalInfo(newText);
            }
        }
    };
    if (!myInternalMode) {
        myDetailsTabForm = new DetailsTabForm(null, false);
        myCommentsTabForm = new CommentsTabForm();
        myCommentsTabForm.addCommentsListener(commentsListener);
        myTabs.addTab(DiagnosticBundle.message("error.comments.tab.title"), myCommentsTabForm.getContentPane());
        myDetailsTabForm.setCommentsAreaVisible(false);
    } else {
        final AnAction analyzePlatformAction = ActionManager.getInstance().getAction("AnalyzeStacktraceOnError");
        if (analyzePlatformAction != null) {
            myAnalyzeAction = new AnalyzeAction(analyzePlatformAction);
        }
        myDetailsTabForm = new DetailsTabForm(myAnalyzeAction, true);
        myDetailsTabForm.setCommentsAreaVisible(true);
        myDetailsTabForm.addCommentsListener(commentsListener);
    }
    myTabs.addTab(DiagnosticBundle.message("error.details.tab.title"), myDetailsTabForm.getContentPane());
    myAttachmentsTabForm = new AttachmentsTabForm();
    myAttachmentsTabForm.addInclusionListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            updateAttachmentWarning(getSelectedMessage());
        }
    });
    int activeTabIndex = Integer.parseInt(PropertiesComponent.getInstance().getValue(ACTIVE_TAB_OPTION, "0"));
    if (activeTabIndex >= myTabs.getTabCount() || activeTabIndex < 0) {
        // may happen if myInternalMode changed since last open
        activeTabIndex = 0;
    }
    myTabs.setSelectedIndex(activeTabIndex);
    myTabs.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            final JComponent c = getPreferredFocusedComponent();
            if (c != null) {
                IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(c, true);
            }
        }
    });
    myTabsPanel.add(myTabs, BorderLayout.CENTER);
    myDisableLink.setHyperlinkText(UIUtil.removeMnemonic(DiagnosticBundle.message("error.list.disable.plugin")));
    myDisableLink.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                disablePlugin();
            }
        }
    });
    myCredentialsLabel.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                JetBrainsAccountDialogKt.showJetBrainsAccountDialog(getRootPane()).show();
                updateCredentialsPane(getSelectedMessage());
            }
        }
    });
    myAttachmentWarningLabel.setIcon(UIUtil.getBalloonWarningIcon());
    myAttachmentWarningLabel.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(final HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                myTabs.setSelectedIndex(myTabs.indexOfComponent(myAttachmentsTabForm.getContentPane()));
                myAttachmentsTabForm.selectFirstIncludedAttachment();
            }
        }
    });
    myDetailsTabForm.addAssigneeListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (myMute)
                return;
            AbstractMessage message = getSelectedMessage();
            if (message != null) {
                message.setAssigneeId(myDetailsTabForm.getAssigneeId());
            }
        }
    });
    return myContentPane;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) ActionEvent(java.awt.event.ActionEvent) HeaderlessTabbedPane(com.intellij.ui.HeaderlessTabbedPane) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) HyperlinkListener(javax.swing.event.HyperlinkListener) ChangeListener(javax.swing.event.ChangeListener)

Example 20 with ChangeListener

use of javax.swing.event.ChangeListener in project intellij-plugins by JetBrains.

the class AirPackageDialog method createUIComponents.

private void createUIComponents() {
    myTree = new FlexBCTree(myProject, bc -> {
        final BuildConfigurationNature nature = bc.getNature();
        return nature.isApp() && !nature.isWebPlatform();
    });
    myTree.addToggleCheckBoxListener(new ChangeListener() {

        public void stateChanged(final ChangeEvent e) {
            updateControlsEnabledState();
        }
    });
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) ActionListener(java.awt.event.ActionListener) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) ChangeListener(javax.swing.event.ChangeListener) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) ValidationInfo(com.intellij.openapi.ui.ValidationInfo) ChangeEvent(javax.swing.event.ChangeEvent) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) ValidateFlashConfigurationsPrecompileTask(com.intellij.lang.javascript.flex.build.ValidateFlashConfigurationsPrecompileTask) ActionEvent(java.awt.event.ActionEvent) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) AirPackageProjectParameters(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageProjectParameters) AirPackagingOptions(com.intellij.lang.javascript.flex.projectStructure.model.AirPackagingOptions) Pair(com.intellij.openapi.util.Pair) Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ChangeEvent(javax.swing.event.ChangeEvent) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

ChangeListener (javax.swing.event.ChangeListener)472 ChangeEvent (javax.swing.event.ChangeEvent)449 ActionEvent (java.awt.event.ActionEvent)170 ActionListener (java.awt.event.ActionListener)164 Dimension (java.awt.Dimension)160 JPanel (javax.swing.JPanel)136 Point (java.awt.Point)108 JLabel (javax.swing.JLabel)98 JSlider (javax.swing.JSlider)69 JButton (javax.swing.JButton)66 JCheckBox (javax.swing.JCheckBox)55 MouseEvent (java.awt.event.MouseEvent)47 BorderLayout (java.awt.BorderLayout)46 GridBagConstraints (java.awt.GridBagConstraints)42 GridBagLayout (java.awt.GridBagLayout)39 MouseAdapter (java.awt.event.MouseAdapter)39 Insets (java.awt.Insets)37 PropertyChangeListener (java.beans.PropertyChangeListener)35 PropertyChangeEvent (java.beans.PropertyChangeEvent)34 ItemEvent (java.awt.event.ItemEvent)33