當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。