當前位置: 首頁>>代碼示例>>Java>>正文


Java ComboBox.setSelectedIndex方法代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.ComboBox.setSelectedIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboBox.setSelectedIndex方法的具體用法?Java ComboBox.setSelectedIndex怎麽用?Java ComboBox.setSelectedIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setSelectedIndex方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

示例2: createOptionsPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:StringConcatenationArgumentToLogCallInspection.java

示例3: doCreateCenterPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
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;
}
 
開發者ID:westlinkin,項目名稱:AndroidLocalizationer,代碼行數:18,代碼來源:AddFilterRuleDialog.java

示例4: SelectOwner

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
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);
}
 
開發者ID:Floobits,項目名稱:floobits-intellij,代碼行數:18,代碼來源:SelectOwner.java

示例5: CreateNewLibraryDialog

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public CreateNewLibraryDialog(@Nonnull JComponent parent, @Nonnull StructureConfigurableContext context, @Nonnull NewLibraryEditor libraryEditor,
                              @Nonnull 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:consulo,項目名稱:consulo,代碼行數:22,代碼來源:CreateNewLibraryDialog.java

示例6: NameSuggestionsField

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public NameSuggestionsField(String[] nameSuggestions, Project project, FileType fileType) {
  super(new BorderLayout());
  myProject = project;
  if (nameSuggestions == null || nameSuggestions.length <= 1) {
    myComponent = createTextFieldForName(nameSuggestions, fileType);
  }
  else {
    final ComboBox combobox = new ComboBox(nameSuggestions);
    combobox.setSelectedIndex(0);
    setupComboBox(combobox, fileType);
    myComponent = combobox;
  }
  add(myComponent, BorderLayout.CENTER);
  myComboBoxModel = null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:NameSuggestionsField.java

示例7: addComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public JComboBox addComboBox(@NotNull final ObservableList<String> backingList) {
  final CollectionComboBoxModel<String> model = new CollectionComboBoxModel<String>(backingList) {
    @NotNull
    @Override
    public List<String> getItems() {
      return backingList;
    }
  };

  final ComboBox comboBox = new ComboBox(model);

  InvalidationListener onListModified = new InvalidationListener() {
    @Override
    protected void onInvalidated(@NotNull Observable sender) {
      model.update();
      if (backingList.size() > 0 && comboBox.getSelectedIndex() < 0) {
        comboBox.setSelectedIndex(0);
      }
    }
  };

  addComponent(comboBox);
  backingList.addWeakListener(onListModified);
  // Keep weak listener alive as long as the combobox is alive
  comboBox.putClientProperty("onListModified", onListModified);
  return comboBox;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ServicePanelBuilder.java

示例8: initComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void initComboBox(ComboBox comboBox) {
	comboBox.removeAllItems();
	comboBox.setModel(createModel());

	if (comboBox.getModel().getSize() > 0) {
		comboBox.setSelectedIndex(0);
	}
}
 
開發者ID:vlivanov,項目名稱:translate-me,代碼行數:9,代碼來源:TranslationConfigurationForm.java

示例9: initTargetResolutions

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void initTargetResolutions() {ComboBox targetResolutionComboBox = new ComboBox();
    targetResolutionComboBox.addItem(Resolution.LDPI.getName());
    targetResolutionComboBox.addItem(Resolution.MDPI.getName());
    targetResolutionComboBox.addItem(Resolution.HDPI.getName());
    targetResolutionComboBox.addItem(Resolution.XHDPI.getName());
    targetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
    targetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
    targetResolutionComboBox.setSelectedIndex(3);
    table.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(targetResolutionComboBox));
}
 
開發者ID:sayedyousef,項目名稱:plgin,代碼行數:11,代碼來源:AndroidBatchScaleImporter.java

示例10: initAssetResolutions

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void initAssetResolutions() {ComboBox assetResolutionComboBox = new ComboBox();
    assetResolutionComboBox.addItem(Resolution.LDPI.getName());
    assetResolutionComboBox.addItem(Resolution.MDPI.getName());
    assetResolutionComboBox.addItem(Resolution.HDPI.getName());
    assetResolutionComboBox.addItem(Resolution.XHDPI.getName());
    assetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
    assetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
    assetResolutionComboBox.addItem(Resolution.OTHER.getName());
    assetResolutionComboBox.setSelectedIndex(3);
    table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(assetResolutionComboBox));
}
 
開發者ID:sayedyousef,項目名稱:plgin,代碼行數:12,代碼來源:AndroidBatchScaleImporter.java

示例11: createComponent

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@Nullable
@Override
public JComponent createComponent() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    panel.add(new JLabel("Module type:"));

    comboModuleType = new ComboBox(new String[] { "Application", "Console application", "Library" });
    comboModuleType.setSelectedIndex(moduleTypeToComboIndex(component.getModuleType()));
    panel.add(comboModuleType);

    return panel;
}
 
開發者ID:rokups,項目名稱:intelli-nim,代碼行數:15,代碼來源:NimModuleTypeEditor.java

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

示例13: NameSuggestionsField

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public NameSuggestionsField(String[] nameSuggestions, Project project, FileType fileType) {
  super(new BorderLayout());
  myProject = project;
  if (nameSuggestions == null || nameSuggestions.length <= 1) {
    myComponent = createTextFieldForName(nameSuggestions, fileType);
  }
  else {
    final ComboBox combobox = new ComboBox(nameSuggestions,-1);
    combobox.setSelectedIndex(0);
    setupComboBox(combobox, fileType);
    myComponent = combobox;
  }
  add(myComponent, BorderLayout.CENTER);
  myComboBoxModel = null;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:16,代碼來源:NameSuggestionsField.java

示例14: SelectAccount

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public SelectAccount(@Nullable Project project, String[] accounts) {
    super(project);
    setTitle("Select a Floobits Account");
    contentPanel = new JPanel();
    cccccomboBox = new ComboBox(new DefaultComboBoxModel(accounts));
    if (accounts.length > 0) {
        cccccomboBox.setSelectedIndex(0);
    }
    contentPanel.add(cccccomboBox);
    JLabel label = new JLabel("Select Account");
    contentPanel.add(label);
    init();
}
 
開發者ID:Floobits,項目名稱:floobits-intellij,代碼行數:14,代碼來源:SelectAccount.java


注:本文中的com.intellij.openapi.ui.ComboBox.setSelectedIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。