Search in sources :

Example 6 with ComboBox

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

the class GitlabRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myProjectLabel = new JBLabel("Project:", SwingConstants.RIGHT);
    myProjectComboBox = new ComboBox(300);
    myProjectComboBox.setRenderer(new TaskUiUtil.SimpleComboBoxRenderer("Set server URL and token first"));
    myProjectLabel.setLabelFor(myProjectComboBox);
    return new FormBuilder().addLabeledComponent(myProjectLabel, myProjectComboBox).getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) JBLabel(com.intellij.ui.components.JBLabel) ComboBox(com.intellij.openapi.ui.ComboBox) TaskUiUtil(com.intellij.tasks.impl.TaskUiUtil) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with ComboBox

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

the class MantisRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myProjectLabel = new JBLabel("Project:", SwingConstants.RIGHT);
    myProjectCombobox = new ComboBox(200);
    myProjectCombobox.setRenderer(new TaskUiUtil.SimpleComboBoxRenderer("Login first"));
    myFilterLabel = new JBLabel("Filter:", SwingConstants.RIGHT);
    myFilterCombobox = new ComboBox(200);
    myFilterCombobox.setRenderer(new TaskUiUtil.SimpleComboBoxRenderer("Login first"));
    return FormBuilder.createFormBuilder().addLabeledComponent(myProjectLabel, myProjectCombobox).addLabeledComponent(myFilterLabel, myFilterCombobox).getPanel();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) ComboBox(com.intellij.openapi.ui.ComboBox) TaskUiUtil(com.intellij.tasks.impl.TaskUiUtil) Nullable(org.jetbrains.annotations.Nullable)

Example 8 with ComboBox

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

the class PyActiveSdkConfigurable method layoutPanel.

private void layoutPanel() {
    final GridBagLayout layout = new GridBagLayout();
    myMainPanel = new JPanel(layout);
    final JLabel interpreterLabel = new JLabel(PyBundle.message("active.sdk.dialog.project.interpreter"));
    final JLabel emptyLabel = new JLabel("  ");
    mySdkCombo = new ComboBox() {

        @Override
        public void setSelectedItem(Object item) {
            if (SHOW_ALL.equals(item)) {
                ApplicationManager.getApplication().invokeLater(() -> {
                    PythonSdkDetailsDialog moreDialog = myModule == null ? new PythonSdkDetailsDialog(myProject, myAddSdkCallback, getSettingsModifiedCallback()) : new PythonSdkDetailsDialog(myModule, myAddSdkCallback, getSettingsModifiedCallback());
                    moreDialog.show();
                });
                return;
            }
            if (!PySdkListCellRenderer.SEPARATOR.equals(item))
                super.setSelectedItem(item);
        }

        @Override
        public void paint(Graphics g) {
            try {
                putClientProperty("JComboBox.isTableCellEditor", Boolean.FALSE);
                super.paint(g);
            } finally {
                putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
            }
        }
    };
    mySdkCombo.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    final PackagesNotificationPanel notificationsArea = new PackagesNotificationPanel();
    final JComponent notificationsComponent = notificationsArea.getComponent();
    final Dimension preferredSize = mySdkCombo.getPreferredSize();
    mySdkCombo.setPreferredSize(preferredSize);
    notificationsArea.hide();
    myDetailsButton = new FixedSizeButton();
    myDetailsButton.setIcon(PythonIcons.Python.InterpreterGear);
    //noinspection SuspiciousNameCombination
    myDetailsButton.setPreferredSize(new Dimension(preferredSize.height, preferredSize.height));
    myPackagesPanel = new PyInstalledPackagesPanel(myProject, notificationsArea);
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridx = 0;
    c.gridy = 0;
    myMainPanel.add(interpreterLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.1;
    myMainPanel.add(mySdkCombo, c);
    c.insets = new Insets(2, 0, 2, 2);
    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.0;
    myMainPanel.add(myDetailsButton, c);
    final PyCustomSdkUiProvider customUiProvider = PyCustomSdkUiProvider.getInstance();
    if (customUiProvider != null) {
        myDisposable = Disposer.newDisposable();
        customUiProvider.customizeActiveSdkPanel(myProject, mySdkCombo, myMainPanel, c, myDisposable);
    }
    c.insets = new Insets(2, 2, 0, 2);
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 3;
    c.weightx = 0.0;
    myMainPanel.add(emptyLabel, c);
    c.gridx = 0;
    c.gridy++;
    c.weighty = 1.;
    c.gridwidth = 3;
    c.gridheight = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.BOTH;
    myMainPanel.add(myPackagesPanel, c);
    c.gridheight = GridBagConstraints.REMAINDER;
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 3;
    c.weighty = 0.;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.SOUTH;
    myMainPanel.add(notificationsComponent, c);
}
Also used : PackagesNotificationPanel(com.intellij.webcore.packaging.PackagesNotificationPanel) ComboBox(com.intellij.openapi.ui.ComboBox) PyInstalledPackagesPanel(com.jetbrains.python.packaging.ui.PyInstalledPackagesPanel) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton)

Example 9 with ComboBox

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

the class SetBackgroundImageDialog method createUIComponents.

private void createUIComponents() {
    ComboBox<String> comboBox = new ComboBox<>(new CollectionComboBoxModel<String>(), 100);
    myPathField = new ComboboxWithBrowseButton(comboBox);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) ComboboxWithBrowseButton(com.intellij.ui.ComboboxWithBrowseButton)

Example 10 with ComboBox

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

the class FullyQualifiedNamesInJavadocOptionProvider method composePanel.

private void composePanel() {
    myPanel = new JPanel(new GridBagLayout());
    myComboBox = new ComboBox();
    for (QualifyJavadocOptions options : QualifyJavadocOptions.values()) {
        myComboBox.addItem(options);
    }
    myComboBox.setRenderer(new ListCellRendererWrapper() {

        @Override
        public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
            if (value instanceof QualifyJavadocOptions) {
                setText(((QualifyJavadocOptions) value).getPresentableText());
            }
        }
    });
    JLabel title = new JLabel(ApplicationBundle.message("radio.use.fully.qualified.class.names.in.javadoc"));
    myPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints left = new GridBagConstraints();
    left.anchor = GridBagConstraints.WEST;
    GridBagConstraints right = new GridBagConstraints();
    right.anchor = GridBagConstraints.WEST;
    right.weightx = 1.0;
    right.insets = JBUI.insetsLeft(5);
    myPanel.add(title, left);
    myPanel.add(myComboBox, right);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) ListCellRendererWrapper(com.intellij.ui.ListCellRendererWrapper)

Aggregations

ComboBox (com.intellij.openapi.ui.ComboBox)46 Nullable (org.jetbrains.annotations.Nullable)12 ActionListener (java.awt.event.ActionListener)11 ActionEvent (java.awt.event.ActionEvent)10 JBLabel (com.intellij.ui.components.JBLabel)7 NotNull (org.jetbrains.annotations.NotNull)7 JBTextField (com.intellij.ui.components.JBTextField)6 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)5 AndroidTargetHash.getAddonHashString (com.android.sdklib.AndroidTargetHash.getAddonHashString)4 BuildFileKey (com.android.tools.idea.gradle.parser.BuildFileKey)4 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)4 Project (com.intellij.openapi.project.Project)4 javax.swing (javax.swing)4 Module (com.intellij.openapi.module.Module)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 JBCheckBox (com.intellij.ui.components.JBCheckBox)3 java.awt (java.awt)3 ItemEvent (java.awt.event.ItemEvent)3 ItemListener (java.awt.event.ItemListener)3 CompletionResultSet (com.intellij.codeInsight.completion.CompletionResultSet)2