Search in sources :

Example 21 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class Java15APIUsageInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
    panel.add(new JLabel("Forbid API usages:"));
    final JRadioButton projectRb = new JRadioButton("Respecting to project language level settings");
    panel.add(projectRb);
    final JRadioButton customRb = new JRadioButton("Higher than:");
    panel.add(customRb);
    final ButtonGroup gr = new ButtonGroup();
    gr.add(projectRb);
    gr.add(customRb);
    final DefaultComboBoxModel cModel = new DefaultComboBoxModel();
    for (LanguageLevel level : LanguageLevel.values()) {
        //noinspection unchecked
        cModel.addElement(level);
    }
    @SuppressWarnings("unchecked") final JComboBox llCombo = new JComboBox(cModel) {

        @Override
        public void setEnabled(boolean b) {
            if (b == customRb.isSelected()) {
                super.setEnabled(b);
            }
        }
    };
    llCombo.setSelectedItem(myEffectiveLanguageLevel != null ? myEffectiveLanguageLevel : LanguageLevel.JDK_1_3);
    //noinspection unchecked
    llCombo.setRenderer(new ListCellRendererWrapper<LanguageLevel>() {

        @Override
        public void customize(JList list, LanguageLevel value, int index, boolean selected, boolean hasFocus) {
            if (value != null) {
                setText(value.getPresentableText());
            }
        }
    });
    llCombo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            myEffectiveLanguageLevel = (LanguageLevel) llCombo.getSelectedItem();
        }
    });
    final JPanel comboPanel = new JPanel(new BorderLayout());
    comboPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
    comboPanel.add(llCombo, BorderLayout.WEST);
    panel.add(comboPanel);
    final ActionListener actionListener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (projectRb.isSelected()) {
                myEffectiveLanguageLevel = null;
            } else {
                myEffectiveLanguageLevel = (LanguageLevel) llCombo.getSelectedItem();
            }
            UIUtil.setEnabled(comboPanel, !projectRb.isSelected(), true);
        }
    };
    projectRb.addActionListener(actionListener);
    customRb.addActionListener(actionListener);
    projectRb.setSelected(myEffectiveLanguageLevel == null);
    customRb.setSelected(myEffectiveLanguageLevel != null);
    UIUtil.setEnabled(comboPanel, !projectRb.isSelected(), true);
    return panel;
}
Also used : ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) LanguageLevel(com.intellij.pom.java.LanguageLevel) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 22 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class UpdateCopyrightAction method getAdditionalActionSettings.

@Nullable
@Override
protected JComponent getAdditionalActionSettings(Project project, BaseAnalysisActionDialog dialog) {
    final JPanel panel = new JPanel(new VerticalFlowLayout());
    panel.add(new TitledSeparator());
    myUpdateExistingCopyrightsCb = new JCheckBox("Update existing copyrights", PropertiesComponent.getInstance().getBoolean(UPDATE_EXISTING_COPYRIGHTS, true));
    panel.add(myUpdateExistingCopyrightsCb);
    return panel;
}
Also used : TitledSeparator(com.intellij.ui.TitledSeparator) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 23 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class ExtractIncludeDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new VerticalFlowLayout());
    JLabel nameLabel = new JLabel();
    panel.add(nameLabel);
    myNameField = new JTextField();
    nameLabel.setLabelFor(myNameField);
    myNameField.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            validateOKButton();
        }
    });
    panel.add(myNameField);
    nameLabel.setText(getNameLabel());
    myTargetDirLabel = new JLabel();
    panel.add(myTargetDirLabel);
    myTargetDirectoryField = new TextFieldWithBrowseButton();
    myTargetDirectoryField.setText(myCurrentDirectory.getVirtualFile().getPresentableUrl());
    myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("select.target.directory.description"), null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    myTargetDirLabel.setText(RefactoringBundle.message("extract.to.directory"));
    panel.add(myTargetDirectoryField);
    myTargetDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent event) {
            validateOKButton();
        }
    });
    validateOKButton();
    return panel;
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 24 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class EditorConfigConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    myEnabled = new JBCheckBox("Enable EditorConfig support");
    final JPanel result = new JPanel();
    result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS));
    final JPanel panel = new JPanel(new VerticalFlowLayout());
    result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false));
    panel.add(myEnabled);
    final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings");
    warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
    warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0));
    panel.add(warning);
    panel.setAlignmentY(Component.TOP_ALIGNMENT);
    result.add(panel);
    final JButton export = new JButton("Export");
    export.addActionListener((event) -> {
        final Component parent = UIUtil.findUltimateParent(result);
        if (parent instanceof IdeFrame) {
            Utils.export(((IdeFrame) parent).getProject());
        }
    });
    export.setAlignmentY(Component.TOP_ALIGNMENT);
    result.add(export);
    return result;
}
Also used : IdeFrame(com.intellij.openapi.wm.IdeFrame) JBCheckBox(com.intellij.ui.components.JBCheckBox) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 25 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class RestoreReferencesDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
    myList = new JBList(myNamedElements);
    myList.setCellRenderer(new FQNameCellRenderer());
    panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);
    panel.add(new JBLabel(myContainsClassesOnly ? CodeInsightBundle.message("dialog.paste.on.import.text") : CodeInsightBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), BorderLayout.NORTH);
    final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
    final JButton okButton = new JButton(CommonBundle.getOkButtonText());
    getRootPane().setDefaultButton(okButton);
    buttonPanel.add(okButton);
    final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
    buttonPanel.add(cancelButton);
    panel.setPreferredSize(JBUI.size(500, 400));
    return panel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) JBList(com.intellij.ui.components.JBList) FQNameCellRenderer(com.intellij.ide.util.FQNameCellRenderer) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Aggregations

VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)34 Nullable (org.jetbrains.annotations.Nullable)8 JBLabel (com.intellij.ui.components.JBLabel)7 NotNull (org.jetbrains.annotations.NotNull)6 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 EditorTextField (com.intellij.ui.EditorTextField)3 TitledSeparator (com.intellij.ui.TitledSeparator)3 JBList (com.intellij.ui.components.JBList)3 JBScrollPane (com.intellij.ui.components.JBScrollPane)3 FormBuilder (com.intellij.util.ui.FormBuilder)3 ArrayList (java.util.ArrayList)3 Document (com.intellij.openapi.editor.Document)2 ComboBox (com.intellij.openapi.ui.ComboBox)2 JBPanel (com.intellij.ui.components.JBPanel)2 JCheckBox (javax.swing.JCheckBox)2 JPanel (javax.swing.JPanel)2 Density (com.android.resources.Density)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 ImageComponent (com.android.tools.idea.ui.ImageComponent)1