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


Java ComboBox.setSelectedItem方法代码示例

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


在下文中一共展示了ComboBox.setSelectedItem方法的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: 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

示例3: 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

示例4: AndroidApplicationModifiedSettingsStep

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

示例5: updateReferenceValues

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

示例6: createTopRightComponent

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected JComponent createTopRightComponent(final JTextField nameField) {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.EP_NAME.getExtensions()) {
    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);
      }
    }
  });

  return LabeledComponent.left(artifactTypeBox, "Type");
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ArtifactConfigurable.java

示例7: createLanguageViews

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void createLanguageViews() {
    jlLanguage = new JLabel(Localizer.get("settings.Language"));

    comboLanguages = new ComboBox(new EnumComboBoxModel<>(Language.class));
    if (SaveUtil.reader().getLanguage() != null) {
        comboLanguages.setSelectedItem(SaveUtil.reader().getLanguage());
    }
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:9,代码来源:SettingsDialog.java

示例8: GitPushTagPanel

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public GitPushTagPanel(@Nullable GitPushTagMode defaultMode, boolean followTagsSupported) {
  String checkboxText = "Push Tags";
  if (followTagsSupported) {
    checkboxText += ": ";
  }
  myCheckBox = new JBCheckBox(checkboxText);
  myCheckBox.setMnemonic('T');
  myCheckBox.setSelected(defaultMode != null);

  setLayout(new BorderLayout());
  add(myCheckBox, BorderLayout.WEST);

  if (followTagsSupported) {
    myCombobox = new ComboBox(GitPushTagMode.getValues());
    myCombobox.setRenderer(new ListCellRendererWrapper<GitPushTagMode>() {
      @Override
      public void customize(JList list, GitPushTagMode value, int index, boolean selected, boolean hasFocus) {
        setText(value.getTitle());
      }
    });
    myCombobox.setEnabled(myCheckBox.isSelected());
    if (defaultMode != null) {
      myCombobox.setSelectedItem(defaultMode);
    }

    myCheckBox.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(@NotNull ActionEvent e) {
        myCombobox.setEnabled(myCheckBox.isSelected());
      }
    });
    add(myCombobox, BorderLayout.CENTER);
  }
  else {
    myCombobox = null;
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GitPushTagPanel.java

示例9: createComponent

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Nullable
@Override
public JComponent createComponent() {
    if (settingPanel == null) {
        settingPanel = new JPanel(new VerticalLayout(18));

        // header UI
        Container container = new Container();
        container.setLayout(new BorderLayout());

        currentEngine = TranslationEngineType.fromName(
                PropertiesComponent.getInstance().getValue(StorageDataKey.SettingLanguageEngine));
        TranslationEngineType[] items = TranslationEngineType.getLanguageEngineArray();
        languageEngineBox = new ComboBox(items);
        languageEngineBox.setEnabled(true);
        languageEngineBox.setSelectedItem(currentEngine);
        languageEngineBox.addActionListener(this);

        container.add(new JLabel("Language engine: "), BorderLayout.WEST);
        container.add(languageEngineBox, BorderLayout.CENTER);

        settingPanel.add(container);

        initContentContainer();
        initAndAddFilterContainer();
    }
    return settingPanel;
}
 
开发者ID:westlinkin,项目名称:AndroidLocalizationer,代码行数:29,代码来源:SettingConfigurable.java

示例10: initCombo

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
void initCombo(final ComboBox combobox, final JPanel parentPanel) {
    combobox.setModel(new DefaultComboBoxModel(JsonDataType.values()));
    combobox.setRenderer(new ColoredListCellRenderer() {

        @Override
        protected void customizeCellRenderer(JList jList, Object o, int i, boolean b, boolean b2) {
            append(((JsonDataType) o).type);
        }
    });

    combobox.setSelectedItem(null);
    combobox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            JsonDataType selectedType = (JsonDataType) combobox.getSelectedItem();
            currentEditor = UI_COMPONENT_BY_JSON_DATATYPE.get(selectedType);
            currentEditor.reset();

            parentPanel.invalidate();
            parentPanel.removeAll();
            parentPanel.add(currentEditor.getComponent(), BorderLayout.CENTER);
            parentPanel.validate();
        }
    });

    combobox.setSelectedItem(JsonDataType.STRING);
}
 
开发者ID:dboissier,项目名称:nosql4idea,代码行数:29,代码来源:AbstractAddDialog.java

示例11: createUIComponents

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void createUIComponents() {
	model = new DefaultComboBoxModel(new String[]{
					"UTF-8",
					"ASCII",
					"CP1256",
					"ISO-8859-1",
					"ISO-8859-2",
					"ISO-8859-6",
					"ISO-8859-15",
					"Windows-1252"});
	myComboBox = new ComboBox(model, 20);
	myComboBox.setEditable(true);
	myComboBox.setOpaque(true);
	defaultColor = myComboBox.getForeground();
	myComboBox.setSelectedItem("UTF-8");
	final JTextComponent tc = (JTextComponent) myComboBox.getEditor().getEditorComponent();

	tc.getDocument().addDocumentListener(new DocumentAdapter() {
		@Override
		protected void textChanged(DocumentEvent documentEvent) {
			JTextField editorJComp = (JTextField) myComboBox.getEditor().getEditorComponent();
			try {
				Charset instance = Charset.forName(getCharset());
				editorJComp.setForeground(defaultColor);
			} catch (Exception ee) {
				editorJComp.setForeground(JBColor.RED);
			}
		}
	});

}
 
开发者ID:krasa,项目名称:StringManipulation,代码行数:32,代码来源:Base64EncodingDialog.java

示例12: initDoctypeField

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initDoctypeField()
{
    doctypeField = new ComboBox(new DefaultComboBoxModel(getSortedDoctypes().toArray()));
    doctypeField.setSelectedItem(doctype);
    doctypeField.addActionListener(new ActionListener()
    {
        @Override
        public void actionPerformed(ActionEvent actionEvent)
        {
            doctype = getSelectedDoctype();
        }
    });
}
 
开发者ID:monday-consulting,项目名称:idea-coremedia-plugin,代码行数:14,代码来源:CreateBeansDialog.java

示例13: createUIComponents

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void createUIComponents() {
    //get available generators for combobox
    PerfCakeClassProvider classProvider = new PerfCakeClassProvider();
    DefaultComboBoxModel generators = null;
    try {
        generators = new DefaultComboBoxModel<String>(classProvider.findGenerators());
    } catch (PerfCakeClassProviderException e) {
        LOG.error("Error finding generators for GeneratorDialog ComboBox", e);
    }
    generatorComboBox = new ComboBox(generators);
    //set selected generator from model
    String modelValue = mockCopy.getClazz().getStringValue();
    generators.setSelectedItem(modelValue);

    String[] predefinedRunTypes = {
            "iteration",
            "time",
            "percentage"
    };

    runComboBox = new ComboBox(predefinedRunTypes);
    runComboBox.setEditable(true);
    runComboBox.setSelectedItem(mockCopy.getRun().getType().getStringValue());


    propertiesEditor = new PropertiesEditor(mockCopy);
}
 
开发者ID:PerfCake,项目名称:PerfCakeIDEA-deprecated,代码行数:28,代码来源:GeneratorDialog.java

示例14: buildProperties

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void buildProperties() {
    // Header
    JLabel jlName = new JLabel(Localizer.get("Name"));
    JLabel jlDescription = new JLabel(Localizer.get("Description"));

    jtfName = new JBTextField(packageTemplate.getName());
    jtaDescription = new JTextArea(packageTemplate.getDescription());

    panelProperties.add(jlName, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("0", "4pt"));
    panelProperties.add(jtfName, new CC().spanX().growX().pushX().wrap());
    panelProperties.add(jlDescription, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("4pt", "4pt"));
    panelProperties.add(jtaDescription, new CC().spanX().growX().pushX().wrap().gapY("0", "4pt"));

    //FileTemplate Source
    ArrayList<FileTemplateSource> actionTypes = new ArrayList<>();
    actionTypes.add(FileTemplateSource.DEFAULT_ONLY);
    actionTypes.add(FileTemplateSource.PROJECT_ONLY);
    actionTypes.add(FileTemplateSource.PROJECT_PRIORITY);
    actionTypes.add(FileTemplateSource.DEFAULT_PRIORITY);

    cboxFileTemplateSource = new ComboBox(actionTypes.toArray());
    cboxFileTemplateSource.setRenderer(new FileTemplateSourceCellRenderer());
    cboxFileTemplateSource.setSelectedItem(packageTemplate.getFileTemplateSource());
    cboxFileTemplateSource.addActionListener (e -> {
        packageTemplate.setFileTemplateSource((FileTemplateSource) cboxFileTemplateSource.getSelectedItem());
    });

    if (mode == ViewMode.USAGE) {
        jtfName.setEditable(false);
        jtaDescription.setEditable(false);
        cboxFileTemplateSource.setEnabled(false);
    } else {
        // Properties
        cbShouldRegisterAction = new JBCheckBox(Localizer.get("property.ShouldRegisterAction"), packageTemplate.isShouldRegisterAction());
        cbSkipDefiningNames = new JBCheckBox(Localizer.get("property.SkipPresettings"), packageTemplate.isSkipDefiningNames());
        panelProperties.add(cbShouldRegisterAction, new CC().wrap().spanX());
        panelProperties.add(cbSkipDefiningNames, new CC().wrap().spanX());
    }

    // Properties
    cbSkipRootDirectory = new JBCheckBox(Localizer.get("property.SkipRootDirectory"), packageTemplate.isSkipRootDirectory());
    cbSkipRootDirectory.addItemListener(e -> {
        collectDataFromFields();
        reBuildElements();
    });
    cbShowReportDialog = new JBCheckBox(Localizer.get("property.ShowReportDialog"), packageTemplate.shouldShowReport());

    panelProperties.add(cbSkipRootDirectory, new CC().spanX().wrap());
    panelProperties.add(cbShowReportDialog, new CC().spanX().wrap());
    panelProperties.add(new JLabel(Localizer.get("FileTemplateSource")), new CC().spanX().split(2));
    panelProperties.add(cboxFileTemplateSource, new CC().pushX().growX().wrap());

}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:54,代码来源:PackageTemplateWrapper.java

示例15: setComboboxModel

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private static void setComboboxModel(TemplatesManager templatesManager, ComboBox comboBox) {
  final Collection<TemplateResource> templates = templatesManager.getAllTemplates();
  comboBox.setModel(new DefaultComboBoxModel(templates.toArray(new TemplateResource[templates.size()])));
  comboBox.setSelectedItem(templatesManager.getDefaultTemplate());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GenerateGetterSetterHandlerBase.java


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