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


Java ComboBox.addItemListener方法代码示例

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


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

示例1: createCustomPanel

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MantisRepositoryEditor.java

示例2: initCommonViews

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initCommonViews() {
    test_type = new ComboBox(new String[]{"Espresso", "Junit"});
    test_type.setBorder(null);
    test_type.addItemListener(e -> {
        if (test_type.getSelectedIndex() == 0) {
            testSelector = new TestSelectorEspresso(tests_panel, search_field, project);
            populate();
        } else {
            testSelector = new TestSelectorJUnit(tests_panel, search_field, project);
            populate();
        }
    });
}
 
开发者ID:amng,项目名称:TestSelector,代码行数:14,代码来源:Main.java

示例3: NodeJSModuleExtensionPanel

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@RequiredDispatchThread
public NodeJSModuleExtensionPanel(final NodeJSMutableModuleExtension extension, Runnable runnable)
{
	super(new VerticalFlowLayout(true, false));

	add(ModuleExtensionSdkBoxBuilder.createAndDefine(extension, runnable).build());

	List<JavaScriptLanguageVersion> validLanguageVersions = StandardJavaScriptVersions.getInstance().getValidLanguageVersions();

	ComboBox languageVersionComboBox = new ComboBox(new CollectionComboBoxModel(validLanguageVersions, extension.getLanguageVersion()));
	languageVersionComboBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			if(e.getStateChange() == ItemEvent.SELECTED)
			{
				//noinspection unchecked
				extension.setLanguageVersion((LanguageVersion) e.getItem());
			}
		}
	});
	languageVersionComboBox.setRenderer(new ColoredListCellRenderer<BaseJavaScriptLanguageVersion>()
	{
		@Override
		protected void customizeCellRenderer(JList list, BaseJavaScriptLanguageVersion value, int index, boolean selected, boolean hasFocus)
		{
			append(value.getPresentableName());
		}
	});

	add(LabeledComponent.create(languageVersionComboBox, "Language Version"));
}
 
开发者ID:consulo,项目名称:consulo-nodejs,代码行数:34,代码来源:NodeJSModuleExtensionPanel.java

示例4: createComboBox

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
/**
 * Creates a Combo Box of String items.
 */
public static ComboBox createComboBox(JComponent parent,
                                      ItemListener listener, String[] items, int defaultSelection) {
    ComboBox comboBox = new ComboBox(items);
    comboBox.setSelectedIndex(defaultSelection);
    comboBox.addItemListener(listener);
    parent.add(comboBox);
    return comboBox;
}
 
开发者ID:TestRoots,项目名称:watchdog,代码行数:12,代码来源:UIUtils.java

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

示例6: ChangeListChooser

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public ChangeListChooser() {
  super(new BorderLayout(4, 2));
  myChooser = new ComboBox();
  //noinspection unchecked
  myChooser.setRenderer(new ColoredListCellRendererWrapper<LocalChangeList>() {
    @Override
    protected void doCustomize(JList list, LocalChangeList value, int index, boolean selected, boolean hasFocus) {
      if (value != null) {
        String name = StringUtil.shortenTextWithEllipsis(value.getName().trim(), MAX_LEN, 0);

        append(name, value.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
      }
    }
  });

  myChooser.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() == ItemEvent.SELECTED) {
        final LocalChangeList changeList = (LocalChangeList)myChooser.getSelectedItem();
        setSelectedList(changeList);
        myChooser.setToolTipText(changeList == null ? "" : (changeList.getName()));
      }
    }
  });

  myChooser.setEditable(false);
  add(myChooser, BorderLayout.CENTER);

  JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label"));
  label.setLabelFor(myChooser);
  add(label, BorderLayout.WEST);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:MultipleChangeListBrowser.java

示例7: ClientJavaScriptModuleExtensionPanel

import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public ClientJavaScriptModuleExtensionPanel(final JavaScriptMutableModuleExtension<?> extension)
{
	super(new VerticalFlowLayout(true, false));

	List<JavaScriptLanguageVersion> validLanguageVersions = StandardJavaScriptVersions.getInstance().getValidLanguageVersions();

	ComboBox languageVersionComboBox = new ComboBox(new CollectionComboBoxModel(validLanguageVersions, extension.getLanguageVersion()));
	languageVersionComboBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			if(e.getStateChange() == ItemEvent.SELECTED)
			{
				//noinspection unchecked
				extension.setLanguageVersion((LanguageVersion) e.getItem());
			}
		}
	});
	languageVersionComboBox.setRenderer(new ColoredListCellRenderer<BaseJavaScriptLanguageVersion>()
	{
		@Override
		protected void customizeCellRenderer(@NotNull JList list, BaseJavaScriptLanguageVersion value, int index, boolean selected, boolean hasFocus)
		{
			append(value.getPresentableName());
		}
	});

	add(LabeledComponent.left(languageVersionComboBox, "Language Version"));
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:31,代码来源:ClientJavaScriptModuleExtensionPanel.java


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