Java 类com.intellij.openapi.ui.ComboBox 实例源码

项目:educational-plugin    文件:PyCCChangeCourseInfo.java   
protected void setupLanguageLevels(Course course, CCNewProjectPanel panel) {
  JLabel languageLevelLabel = panel.getLanguageLevelLabel();
  languageLevelLabel.setText("Python:");
  languageLevelLabel.setVisible(true);
  ComboBox<String> languageLevelCombobox = panel.getLanguageLevelCombobox();
  languageLevelCombobox.addItem(ALL_VERSIONS);
  languageLevelCombobox.addItem(PYTHON_3);
  languageLevelCombobox.addItem(PYTHON_2);
  for (LanguageLevel level : LanguageLevel.values()) {
    languageLevelCombobox.addItem(level.toString());
  }
  languageLevelCombobox.setVisible(true);
  final String version = course.getLanguageVersion();
  if (version != null) {
    languageLevelCombobox.setSelectedItem(version);
  }
  else {
    languageLevelCombobox.setSelectedItem(ALL_VERSIONS);
  }
}
项目:intellij-nette-tester    文件:TesterConfigurableForm.java   
private void createUIComponents() {
    defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension"));
    defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"});

    bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile"));
    bootstrapFileField = new TextFieldWithBrowseButton();
    bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    namespaceMappingTable = new NamespaceMappingTable(project);
    namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() {
        @Override
        public TesterNamespaceMapping createElement() {
            return new TesterNamespaceMapping();
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    }).createPanel();

    namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title")));
}
项目:PackageTemplates    文件:SelectFileTemplateDialog.java   
@NotNull
private ComboBox getSelector() {
    ArrayList<TemplateForSearch> listTemplateForSearch = FileTemplateHelper.getTemplates(
            project,
            cbAddInternal.isSelected(),
            cbAddJ2EE.isSelected(),
            ptWrapper.getPackageTemplate().getFileTemplateSource()
    );

    ComboBox comboBox = new ComboBox(listTemplateForSearch.toArray());
    comboBox.setRenderer(new ListCellRendererWrapper<TemplateForSearch>() {
        @Override
        public void customize(JList list, TemplateForSearch template, int index, boolean selected, boolean hasFocus) {
            if (template != null) {
                setIcon(FileTemplateUtil.getIcon(template.getTemplate()));
                setText(template.getTemplate().getName());
            }
        }
    });

    new ComboboxSpeedSearch(comboBox);
    return comboBox;
}
项目:PackageTemplates    文件:WriteRulesDialog.java   
@Override
public void preShow() {
    panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt")));

    //Type
    ArrayList<WriteRules> actionTypes = new ArrayList<>();
    if(hasParent){
        actionTypes.add(WriteRules.FROM_PARENT);
    }
    actionTypes.add(WriteRules.USE_EXISTING);
    actionTypes.add(WriteRules.ASK_ME);
    actionTypes.add(WriteRules.OVERWRITE);

    comboBoxRules = new ComboBox(actionTypes.toArray());
    comboBoxRules.setRenderer(new WriteRulesCellRenderer());
    comboBoxRules.setSelectedItem(writeRules);

    panel.add(comboBoxRules, new CC().pushX().growX().spanX().gapY("10","10"));
}
项目:tmc-intellij    文件:SettingsPanelMock.java   
public void initComponents() {
    panel1 = new JPanel();
    projectPathField = new JFormattedTextField();
    checkForNewOrCheckBox = new JCheckBox();
    checkThatAllActiveCheckBox = new JCheckBox();
    sendDiagnosticsCheckBox = new JCheckBox();
    sendSnapshotsOfYourCheckBox = new JCheckBox();
    selectErrorLanguageField = new ComboBox<>();
    browseButton = new JButton();
    okButton = new JButton();
    cancelButton = new JButton();
    downloadCourseExercisesButton = new JButton();
    logoutButton = new JButton();
    loggedUser = new JLabel();
    currentOrganization = new JLabel();
    changeOrganizationButton = new JButton();
    currentCourse = new JLabel();
    changeCourseButton = new JButton();
}
项目:intellij-ce-playground    文件:DebuggerExpressionComboBox.java   
public DebuggerExpressionComboBox(@NotNull Project project, @NotNull Disposable parentDisposable, @Nullable PsiElement context, @Nullable String recentsId, @NotNull CodeFragmentFactory factory) {
  super(project, factory, parentDisposable, context, recentsId);

  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
项目:intellij-ce-playground    文件:AlternativeSourceNotificationProvider.java   
public AlternativeSourceNotificationPanel(ComboBoxClassElement[] alternatives,
                                          final PsiClass aClass,
                                          final Project project,
                                          final VirtualFile file) {
  setText(DebuggerBundle.message("editor.notification.alternative.source", aClass.getQualifiedName()));
  final ComboBox switcher = new ComboBox(alternatives);
  switcher.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileEditorManager.getInstance(project).closeFile(file);
      PsiClass item = ((ComboBoxClassElement)switcher.getSelectedItem()).myClass;
      item = (PsiClass)item.getNavigationElement(); // go through compiled
      DebuggerUtilsEx.setAlternativeSource(file, item.getContainingFile().getVirtualFile());
      item.navigate(true);
      XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
      if (session != null) {
        session.updateExecutionPosition();
      }
    }
  });
  myLinksPanel.add(switcher);
}
项目:intellij-ce-playground    文件:CreateNewLibraryDialog.java   
public CreateNewLibraryDialog(@NotNull JComponent parent, @NotNull StructureConfigurableContext context, @NotNull NewLibraryEditor libraryEditor,
                               @NotNull List<LibraryTable> libraryTables, int selectedTable) {
  super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
  myContext = context;
  myLibraryEditor = libraryEditor;
  final DefaultComboBoxModel model = new DefaultComboBoxModel();
  for (LibraryTable table : libraryTables) {
    model.addElement(table);
  }
  myLibraryLevelCombobox = new ComboBox(model);
  myLibraryLevelCombobox.setSelectedIndex(selectedTable);
  myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LibraryTable) {
        setText(((LibraryTable)value).getPresentation().getDisplayName(false));
      }
    }
  });
  init();
}
项目:intellij-ce-playground    文件:ArtifactConfigurable.java   
@Override
protected JComponent createTopRightComponent() {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  final JPanel panel = new JPanel(new FlowLayout());
  panel.add(new JLabel("Type: "));
  panel.add(artifactTypeBox);
  return panel;
}
项目:intellij-ce-playground    文件:ClasspathEditor.java   
private ClasspathFormatPanel(@NotNull ClasspathStorageProvider[] providers) {
  super(new GridBagLayout());

  add(new JLabel(ProjectBundle.message("project.roots.classpath.format.label")),
      new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 6, 6, 0), 0, 0));

  formatIdToDescription.put(ClassPathStorageUtil.DEFAULT_STORAGE, ProjectBundle.message("project.roots.classpath.format.default.descr"));
  for (ClasspathStorageProvider provider : providers) {
    formatIdToDescription.put(provider.getID(), provider.getDescription());
  }

  comboBoxClasspathFormat = new ComboBox(formatIdToDescription.values().toArray());
  updateClasspathFormat();
  add(comboBoxClasspathFormat,
      new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 0), 0, 0));
}
项目:intellij-ce-playground    文件:TargetOptionsComponent.java   
private static ComboBox createTargetOptionsCombo() {
  final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
  //combo.setRenderer(new DefaultListCellRenderer() {
  //  @Override
  //  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  //    try {
  //      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  //    }
  //    finally {
  //      //if ("".equals(value)) {
  //      //  setText(COMPILER_DEFAULT);
  //      //}
  //    }
  //  }
  //});
  combo.setEditable(true);
  combo.setEditor(new BasicComboBoxEditor() {
    @Override
    protected JTextField createEditorComponent() {
      return new HintTextField(COMPILER_DEFAULT, 12);
    }
  });
  return combo;
}
项目:intellij-ce-playground    文件:CreatePatchConfigurationPanel.java   
private void initMainPanel() {
  myFileNameField = new TextFieldWithBrowseButton();
  myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox"));
  myEncoding = new ComboBox();
  myIncludeBaseRevisionTextCheckBox = new JCheckBox(VcsBundle.message("create.patch.base.revision", 0));
  myIncludeBaseRevisionTextCheckBox.setToolTipText(VcsBundle.message("create.patch.base.revision.tooltip"));
  myErrorLabel = new JLabel();

  myMainPanel = FormBuilder.createFormBuilder()
    .addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField)
    .addComponent(myReversePatchCheckbox)
    .addComponent(myIncludeBaseRevisionTextCheckBox)
    .addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding)
    .addComponent(myErrorLabel)
    .getPanel();
}
项目:intellij-ce-playground    文件:VcsUpdateInfoScopeFilterConfigurable.java   
VcsUpdateInfoScopeFilterConfigurable(Project project, VcsConfiguration vcsConfiguration) {
  myVcsConfiguration = vcsConfiguration;
  myCheckbox = new JCheckBox(VcsBundle.getString("settings.filter.update.project.info.by.scope"));
  myComboBox = new ComboBox();

  myComboBox.setEnabled(myCheckbox.isSelected());
  myCheckbox.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(@NotNull ChangeEvent e) {
      myComboBox.setEnabled(myCheckbox.isSelected());
    }
  });

  myNamedScopeHolders = NamedScopesHolder.getAllNamedScopeHolders(project);
  for (NamedScopesHolder holder : myNamedScopeHolders) {
    holder.addScopeListener(this);
  }
}
项目:intellij-ce-playground    文件:PrintDialog.java   
private static JComboBox createFontNamesComboBox() {
  GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
  Font[] fonts = graphicsEnvironment.getAllFonts();
  List<String> fontNames = new ArrayList<String>(fonts.length + 5);
  for (Font font : fonts) {
    fontNames.add(font.getName());
  }
  fontNames.add(Font.DIALOG);
  fontNames.add(Font.DIALOG_INPUT);
  fontNames.add(Font.SERIF);
  fontNames.add(Font.SANS_SERIF);
  fontNames.add(Font.MONOSPACED);
  Collections.sort(fontNames);

  JComboBox comboBox = new ComboBox();
  for (String fontName : fontNames) {
    comboBox.addItem(fontName);
  }
  return comboBox;
}
项目:intellij-ce-playground    文件:NameSuggestionsField.java   
private void setupComboBox(final ComboBox combobox, FileType fileType) {
  final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, fileType, combobox) {
    @Override
    public void setItem(Object anObject) {
      myNonHumanChange = true;
      super.setItem(anObject);
    }
  };

  combobox.setEditor(comboEditor);
  combobox.setRenderer(new EditorComboBoxRenderer(comboEditor));

  combobox.setEditable(true);
  combobox.setMaximumRowCount(8);

  comboEditor.selectAll();
}
项目:intellij-ce-playground    文件:AndroidApplicationModifiedSettingsStep.java   
AndroidApplicationModifiedSettingsStep(@NotNull AndroidModuleBuilder builder, @NotNull SettingsStep settingsStep) {
  super(builder, settingsStep);
  final String applicationName = builder.getApplicationName();

  if (applicationName != null && applicationName.length() > 0) {
    settingsStep.getModuleNameField().setText(applicationName);
  }
  final String[] items = {TARGET_DO_NOT_CREATE_RUN_CONF, TARGET_SHOW_CHOOSER_DIALOG,
    TARGET_USB_DEVICE, TARGET_EMULATOR};
  myTargetDeviceCombo = new ComboBox(items);
  settingsStep.addSettingsField("\u001BTarget device: ", myTargetDeviceCombo);
  final String prevTargetMode = PropertiesComponent.getInstance().getValue(TARGET_SELECTION_MODE_FOR_NEW_MODULE_PROPERTY);
  myTargetDeviceCombo.setSelectedItem(prevTargetMode != null && ArrayUtil.contains(prevTargetMode, items)
                                      ? prevTargetMode
                                      : TARGET_SHOW_CHOOSER_DIALOG);
}
项目:intellij-ce-playground    文件:KeyValuePane.java   
public void updateReferenceValues(@NotNull BuildFileKey containerProperty, @NotNull Iterable<String> values) {
  BuildFileKey itemType = containerProperty.getItemType();
  if (itemType == null) {
    return;
  }
  ComboBox comboBox = (ComboBox)myProperties.get(itemType);
  if (comboBox == null) {
    return;
  }
  myIsUpdating = true;
  try {
    String currentValue = comboBox.getEditor().getItem().toString();
    comboBox.removeAllItems();
    for (String value : values) {
      comboBox.addItem(value);
    }
    comboBox.setSelectedItem(currentValue);
  } finally {
    myIsUpdating = false;
  }
}
项目:intellij-ce-playground    文件:BuildVariantView.java   
BuildVariantTable() {
  super(new BuildVariantTableModel(Collections.<Object[]>emptyList()));
  addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      int column = getSelectedColumn();
      int row = getSelectedRow();
      if (column == VARIANT_COLUMN_INDEX && row >= 0 && e.getKeyCode() == KeyEvent.VK_F2 && editCellAt(row, column)) {
        Component editorComponent = getEditorComponent();
        if (editorComponent instanceof ComboBox) {
          editorComponent.requestFocusInWindow();
          ((ComboBox)editorComponent).showPopup();
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:GradleEditorComboBoxEditor.java   
@Override
public boolean hasFocus() {
  final Container parent = getParent();
  if (parent instanceof ComboBox) {
    try {
      Field field = parent.getClass().getDeclaredField("myPaintingNow");
      field.setAccessible(true);
      if (field.get(parent) == Boolean.TRUE) {
        return false; // to disable focus painting around combobox button
      }
    }
    catch (Exception ignore) {
    }
  }
  return super.hasFocus();
}
项目:intellij-ce-playground    文件:ConfigureAvdOptionsStep.java   
private void createUIComponents() {
  myOrientationToggle =
    new ASGallery<ScreenOrientation>(JBList.createDefaultListModel(ScreenOrientation.PORTRAIT, ScreenOrientation.LANDSCAPE),
                                     new Function<ScreenOrientation, Image>() {
                                       @Override
                                       public Image apply(ScreenOrientation input) {
                                         return IconUtil.toImage(ORIENTATIONS.get(input).myIcon);
                                       }
                                     }, new Function<ScreenOrientation, String>() {
      @Override
      public String apply(ScreenOrientation input) {
        return ORIENTATIONS.get(input).myName;
      }
    }, new Dimension(50, 50));
  myOrientationToggle.setCellMargin(new Insets(3, 5, 3, 5));
  myOrientationToggle.setBackground(JBColor.background());
  myOrientationToggle.setForeground(JBColor.foreground());
  myScalingComboBox = new ComboBox(new EnumComboBoxModel<AvdScaleFactor>(AvdScaleFactor.class));
  myHardwareSkinHelpLabel = new HyperlinkLabel("How do I create a custom hardware skin?");
  myHardwareSkinHelpLabel.setHyperlinkTarget(AvdWizardConstants.CREATE_SKIN_HELP_LINK);
  mySkinComboBox = new SkinChooser(getProject());
}
项目:intellij-ce-playground    文件:ConfigureDeviceOptionsStep.java   
private void createUIComponents() {
  myNavigationControlsCombo = new ComboBox(new EnumComboBoxModel<Navigation>(Navigation.class)) {
    @Override
    public ListCellRenderer getRenderer() {
      return new ColoredListCellRenderer() {
        @Override
        protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
          append(((Navigation)value).getShortDisplayValue());
        }
      };
    }
  };

  myHelpAndErrorLabel = new JBLabel();
  myHelpAndErrorLabel.setBackground(JBColor.background());
  myHelpAndErrorLabel.setForeground(JBColor.foreground());
  myHelpAndErrorLabel.setOpaque(true);
  myHardwareSkinHelpLabel = new HyperlinkLabel("How do I create a custom hardware skin?");
  myHardwareSkinHelpLabel.setHyperlinkTarget(AvdWizardConstants.CREATE_SKIN_HELP_LINK);
  myCustomSkinPath = new SkinChooser(getProject());
}
项目:intellij-ce-playground    文件:TrelloRepositoryEditor.java   
@Nullable
@Override
protected JComponent createCustomPanel() {
  myBoardComboBox = new ComboBox(300);
  myBoardLabel = new JBLabel("Board:", SwingConstants.RIGHT);
  myBoardLabel.setLabelFor(myBoardComboBox);

  myListComboBox = new ComboBox(300);
  myListLabel = new JBLabel("List:", SwingConstants.RIGHT);
  myListLabel.setLabelFor(myListComboBox);

  myAllCardsCheckBox = new JBCheckBox("Include cards not assigned to me");

  return FormBuilder.createFormBuilder()
    .addLabeledComponent(myBoardLabel, myBoardComboBox)
    .addLabeledComponent(myListLabel, myListComboBox)
    .addComponentToRightColumn(myAllCardsCheckBox)
    .getPanel();
}
项目:intellij-ce-playground    文件:GitVcsPanel.java   
private void createUIComponents() {
  myProtectedBranchesButton = new TextFieldWithBrowseButton.NoPathCompletion(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      Messages.showTextAreaDialog(myProtectedBranchesButton.getTextField(), "Protected Branches", "Git.Force.Push.Protected.Branches",
                                  ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
    }
  });
  myProtectedBranchesButton.setButtonIcon(AllIcons.Actions.ShowViewer);
  myUpdateMethodComboBox = new ComboBox(new EnumComboBoxModel<UpdateMethod>(UpdateMethod.class));
  myUpdateMethodComboBox.setRenderer(new ListCellRendererWrapper<UpdateMethod>() {
    @Override
    public void customize(JList list, UpdateMethod value, int index, boolean selected, boolean hasFocus) {
      setText(StringUtil.capitalize(StringUtil.toLowerCase(value.name().replace('_', ' '))));
    }
  });
}
项目:intellij-ce-playground    文件:StringConcatenationArgumentToLogCallInspection.java   
@Nullable
@Override
public JComponent createOptionsPanel() {
  final ComboBox comboBox = new ComboBox(new Object[]{
    InspectionGadgetsBundle.message("all.levels.option"),
    InspectionGadgetsBundle.message("warn.level.and.lower.option"),
    InspectionGadgetsBundle.message("info.level.and.lower.option"),
    InspectionGadgetsBundle.message("debug.level.and.lower.option"),
    InspectionGadgetsBundle.message("trace.level.option")
  });
  comboBox.setSelectedIndex(warnLevel);
  comboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      warnLevel = comboBox.getSelectedIndex();
    }
  });
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(FormBuilder.createFormBuilder().addLabeledComponent(InspectionGadgetsBundle.message("warn.on.label"), comboBox).getPanel(),
            BorderLayout.NORTH);
  return panel;
}
项目:intellij-ce-playground    文件:ParametersPerConstructorInspection.java   
@Override
public JComponent createOptionsPanel() {
  final JFormattedTextField valueField = prepareNumberEditor("m_limit");
  final JComboBox comboBox = new ComboBox(new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED});
  comboBox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof Scope) setText(((Scope)value).getText());
    }
  });
  comboBox.setSelectedItem(ignoreScope);
  comboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      ignoreScope = (Scope)comboBox.getSelectedItem();
    }
  });
  comboBox.setPrototypeDisplayValue(Scope.PROTECTED);

  final FormBuilder formBuilder = FormBuilder.createFormBuilder();
  formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
  formBuilder.addLabeledComponent(InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
  return panel;
}
项目:intellij    文件:BlazeIntellijPluginConfiguration.java   
public BlazeIntellijPluginConfigurationSettingsEditor(
    Iterable<Label> javaLabels,
    RunConfigurationStateEditor blazeFlagsEditor,
    RunConfigurationStateEditor exeFlagsEditor) {
  targetCombo =
      new ComboBox<>(
          new DefaultComboBoxModel<>(
              Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
  targetCombo.setRenderer(
      new ListCellRendererWrapper<Label>() {
        @Override
        public void customize(
            JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
          setText(value == null ? null : value.toString());
        }
      });
  this.blazeFlagsEditor = blazeFlagsEditor;
  this.exeFlagsEditor = exeFlagsEditor;
  ProjectSdksModel sdksModel = new ProjectSdksModel();
  sdksModel.reset(null);
  sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);

  keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
  keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
项目:AndroidLocalizationer    文件:AddFilterRuleDialog.java   
protected JComponent doCreateCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout(5, 0));

    FilterRule.FilterRuleType[] types = FilterRule.FilterRuleType.values();

    ruleType = new ComboBox(types);
    ruleType.setEnabled(true);
    ruleType.setSelectedIndex(0);

    panel.add(ruleType, BorderLayout.WEST);

    filterName = new JTextField(20);
    PromptSupport.setPrompt("Set the string name here", filterName);
    panel.add(filterName, BorderLayout.CENTER);

    return panel;
}
项目:JHelper    文件:StreamConfigurationPanel.java   
public StreamConfigurationPanel(
        StreamConfiguration configuration,
        StreamConfiguration.StreamType[] allowedTypes,
        String defaultFileName,
        SizeChangedListener listener
) {
    super(new VerticalLayout());
    type = new ComboBox<>(allowedTypes);
    type.setSelectedItem(configuration.type);
    type.addActionListener(
            e -> {
                fileName.setVisible(((StreamConfiguration.StreamType) type.getSelectedItem()).hasStringParameter);
                if (listener != null) {
                    listener.sizeChanged();
                }
            }
    );
    fileName = new JTextField(configuration.type.hasStringParameter ? configuration.fileName : defaultFileName);
    fileName.setVisible(((StreamConfiguration.StreamType) type.getSelectedItem()).hasStringParameter);

    add(type);
    add(fileName);
}
项目:consulo-nodejs    文件:NodeJSConfigurationPanelBase.java   
@Override
protected void initComponents()
{
    myModuleBox = new ComboBox();
    myModuleBox.setRenderer(new ModuleListCellRenderer());

    myVmParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM arguments");
    myVmParametersComponent.setLabelLocation(BorderLayout.WEST);
    copyDialogCaption(myVmParametersComponent);

    myUseAlternativeBundleCheckBox = new JCheckBox("Use alternative bundle: ");
    ProjectSdksModel projectSdksModel = new ProjectSdksModel();
    projectSdksModel.reset();

    myAlternativeBundleComboBox = new SdkComboBox(projectSdksModel, Conditions.<SdkTypeId>is(NodeJSBundleType.getInstance()), true);
    myAlternativeBundleComboBox.setEnabled(false);
    myUseAlternativeBundleCheckBox.addItemListener(new ItemListener()
    {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
            myAlternativeBundleComboBox.setEnabled(myUseAlternativeBundleCheckBox.isSelected());
        }
    });
    super.initComponents();
}
项目:tools-idea    文件:DebuggerExpressionComboBox.java   
public DebuggerExpressionComboBox(Project project, PsiElement context, @NonNls String recentsId, final CodeFragmentFactory factory) {
  super(project, context, recentsId, factory);
  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
项目:tools-idea    文件:CreateNewLibraryDialog.java   
public CreateNewLibraryDialog(@NotNull JComponent parent, @NotNull StructureConfigurableContext context, @NotNull NewLibraryEditor libraryEditor,
                               @NotNull List<LibraryTable> libraryTables, int selectedTable) {
  super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
  myContext = context;
  myLibraryEditor = libraryEditor;
  final DefaultComboBoxModel model = new DefaultComboBoxModel();
  for (LibraryTable table : libraryTables) {
    model.addElement(table);
  }
  myLibraryLevelCombobox = new ComboBox(model);
  myLibraryLevelCombobox.setSelectedIndex(selectedTable);
  myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LibraryTable) {
        setText(((LibraryTable)value).getPresentation().getDisplayName(false));
      }
    }
  });
  init();
}
项目:tools-idea    文件:ArtifactConfigurable.java   
@Override
protected JComponent createTopRightComponent() {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  final JPanel panel = new JPanel(new FlowLayout());
  panel.add(new JLabel("Type: "));
  panel.add(artifactTypeBox);
  return panel;
}
项目:tools-idea    文件:TargetOptionsComponent.java   
private static ComboBox createTargetOptionsCombo() {
  final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
  //combo.setRenderer(new DefaultListCellRenderer() {
  //  @Override
  //  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  //    try {
  //      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  //    }
  //    finally {
  //      //if ("".equals(value)) {
  //      //  setText(COMPILER_DEFAULT);
  //      //}
  //    }
  //  }
  //});
  combo.setEditable(true);
  combo.setEditor(new BasicComboBoxEditor() {
    @Override
    protected JTextField createEditorComponent() {
      return new HintTextField(COMPILER_DEFAULT, 10);
    }
  });
  return combo;
}
项目:tools-idea    文件:KeymapPanel.java   
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0,0, 1, 1, 0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0));
  panel.add(myKeymapList, new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,4,0,0),0,0));

  panel.add(createKeymapButtonsPanel(), new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0));
  myKeymapList.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(), new GridBagConstraints(3,0,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,10,0,0),0,0));
  return panel;
}
项目:tools-idea    文件:NameSuggestionsField.java   
private void setupComboBox(final ComboBox combobox, FileType fileType) {
  final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, fileType, combobox) {
    @Override
    public void setItem(Object anObject) {
      myNonHumanChange = true;
      super.setItem(anObject);
    }
  };

  combobox.setEditor(comboEditor);
  combobox.setRenderer(new EditorComboBoxRenderer(comboEditor));

  combobox.setEditable(true);
  combobox.setMaximumRowCount(8);

  comboEditor.selectAll();
}
项目:tools-idea    文件:MantisRepositoryEditor.java   
@Nullable
@Override
protected JComponent createCustomPanel() {
  myProjectLabel = new JBLabel("Project:", SwingConstants.RIGHT);
  myProjectCombobox = new ComboBox(200);
  myProjectCombobox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(final ItemEvent e) {
      updateFilters();
    }
  });
  installListener(myProjectCombobox);
  myFilterLabel = new JBLabel("Filter:", SwingConstants.RIGHT);
  myFilterCombobox = new ComboBox(200);
  installListener(myFilterCombobox);
  updateProjects();
  return FormBuilder.createFormBuilder().addLabeledComponent(myProjectLabel, myProjectCombobox)
    .addLabeledComponent(myFilterLabel, myFilterCombobox).getPanel();
}
项目:cordovastudio    文件:StoryboardView.java   
private JComboBox createEditorFor(final Transition transition) {
    String gesture = transition.getType();
    JComboBox c = new ComboBox(new DefaultComboBoxModel(new Object[]{"press", "swipe"}));
    c.setSelectedItem(gesture);
    c.setForeground(getForeground());
    //c.setBorder(LABEL_BORDER);
    //c.setOpaque(true);
    c.setBackground(BACKGROUND_COLOR);
    c.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            transition.setType((String) itemEvent.getItem());
            myCordovaStoryboardModel.getListeners().notify(CordovaStoryboardModel.Event.update(Transition.class));
        }
    });
    return c;
}
项目:floobits-intellij    文件:SelectOwner.java   
protected SelectOwner(List<String> title, RunLater<String> runLater) {
    super(true);
    jPanel = new JPanel();
    this.runLater = runLater;
    init();
    this.setTitle("Select Workspace Owner");

    Object[] organizations = title.toArray();
    orgList = new ComboBox(organizations, 200);
    if (organizations.length > 0) {
        orgList.setSelectedIndex(0);
    }
    JLabel jLabel = new JLabel();
    jLabel.setText("Select the owner for the workspace:");
    jPanel.add(jLabel);
    jPanel.add(orgList);
}
项目:intellij-scratch    文件:NewScratchFileAction.java   
private JComboBox createCombo(List<Language> languages) {
  JComboBox jComboBox = new ComboBox(new CollectionComboBoxModel(languages));
  jComboBox.setRenderer(new ListCellRendererWrapper<Language>() {
    @Override
    public void customize(JList list, Language lang, int index, boolean selected, boolean hasFocus) {
      if (lang != null) {
        setText(lang.getDisplayName());
        LanguageFileType associatedLanguage = lang.getAssociatedFileType();
        if (associatedLanguage != null) setIcon(associatedLanguage.getIcon());
      }
    }
  });
  new ComboboxSpeedSearch(jComboBox) {
    @Override
    protected String getElementText(Object element) {
      return element instanceof Language ? ((Language) element).getDisplayName() : null;
    }
  };
  Language previous = myProject != null ? myProject.getUserData(SCRATCH_LANGUAGE) : null;
  if (previous != null) {
    jComboBox.setSelectedItem(previous);
  }

  return jComboBox;
}
项目:consulo-tasks    文件:MantisRepositoryEditor.java   
@Nullable
@Override
protected JComponent createCustomPanel() {
  myProjectLabel = new JBLabel("Project:", SwingConstants.RIGHT);
  myProjectCombobox = new ComboBox(200);
  myProjectCombobox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(final ItemEvent e) {
      updateFilters();
    }
  });
  installListener(myProjectCombobox);
  myFilterLabel = new JBLabel("Filter:", SwingConstants.RIGHT);
  myFilterCombobox = new ComboBox(200);
  installListener(myFilterCombobox);
  updateProjects();
  return FormBuilder.createFormBuilder().addLabeledComponent(myProjectLabel, myProjectCombobox)
    .addLabeledComponent(myFilterLabel, myFilterCombobox).getPanel();
}