当前位置: 首页>>代码示例>>Java>>正文


Java ComboBox类代码示例

本文整理汇总了Java中com.intellij.openapi.ui.ComboBox的典型用法代码示例。如果您正苦于以下问题:Java ComboBox类的具体用法?Java ComboBox怎么用?Java ComboBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComboBox类属于com.intellij.openapi.ui包,在下文中一共展示了ComboBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupLanguageLevels

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:PyCCChangeCourseInfo.java

示例2: createUIComponents

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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")));
}
 
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:24,代码来源:TesterConfigurableForm.java

示例3: getSelector

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
@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;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:24,代码来源:SelectFileTemplateDialog.java

示例4: preShow

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
@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"));
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:20,代码来源:WriteRulesDialog.java

示例5: initComponents

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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();
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:20,代码来源:SettingsPanelMock.java

示例6: DebuggerExpressionComboBox

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DebuggerExpressionComboBox.java

示例7: AlternativeSourceNotificationPanel

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AlternativeSourceNotificationProvider.java

示例8: CreateNewLibraryDialog

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CreateNewLibraryDialog.java

示例9: createTopRightComponent

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ArtifactConfigurable.java

示例10: ClasspathFormatPanel

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ClasspathEditor.java

示例11: createTargetOptionsCombo

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TargetOptionsComponent.java

示例12: initMainPanel

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CreatePatchConfigurationPanel.java

示例13: VcsUpdateInfoScopeFilterConfigurable

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:VcsUpdateInfoScopeFilterConfigurable.java

示例14: createFontNamesComboBox

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PrintDialog.java

示例15: setupComboBox

import com.intellij.openapi.ui.ComboBox; //导入依赖的package包/类
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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:NameSuggestionsField.java


注:本文中的com.intellij.openapi.ui.ComboBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。