javax.swing.JComboBox.removeItemAt()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中javax.swing.JComboBox.removeItemAt()方法的一些代码示例,展示了JComboBox.removeItemAt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.removeItemAt()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:removeItemAt

JComboBox.removeItemAt介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

private static void setListStrings() {
  Object findObject = FIND_FIELD.getSelectedItem();
  Object replaceObject = REPLACE_FIELD.isShowing() ?
      (String) REPLACE_FIELD.getSelectedItem() : "";
  if (findObject != null && replaceObject != null) {
    boolean found = false;
    for (int i = 0; !found && i < FIND_FIELD.getItemCount(); i++) {
      found = FIND_FIELD.getItemAt(i).equals(findObject);
    }
    if (!found) {
      FIND_FIELD.insertItemAt(findObject, 0);
      if (FIND_FIELD.getItemCount() > 7) {
        FIND_FIELD.removeItemAt(7);
      }
    }
    if (REPLACE_FIELD.isShowing()) {
      found = false;
      for (int i = 0; !found && i < REPLACE_FIELD.getItemCount(); i++) {
        found = REPLACE_FIELD.getItemAt(i).equals(findObject);
      }
      if (!found) {
        REPLACE_FIELD.insertItemAt(replaceObject, 0);
        if (REPLACE_FIELD.getItemCount() > 7) {
          REPLACE_FIELD.removeItemAt(7);
        }
      }
    }
  }
}

代码示例来源:origin: magefree/mage

private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
  if (!cbExpansionSet.getSelectedItem().toString().contains(TEST_MULTI_SET)) {
    int index = cbExpansionSet.getSelectedIndex();
    if (cbExpansionSet.getItemAt(0).contains(TEST_MULTI_SET)) {
      cbExpansionSet.removeItemAt(0);
      index--;
    }
    listCodeSelected.uncheckAll();
    if (index > 0) {
      //ofset because all sets is removed from the list
      listCodeSelected.setChecked(index - 1, true);
    }
  }
  filterCards();
}//GEN-LAST:event_cbExpansionSetActionPerformed

代码示例来源:origin: magefree/mage

cbExpansionSet.removeItemAt(1);

代码示例来源:origin: mucommander/mucommander

@Override
public void removeItemAt(int i) {
  ignoreActionEvent = true;
  super.removeItemAt(i);
  ignoreActionEvent = false;
}

代码示例来源:origin: nl.cloudfarming.client/util-swing

@Override
public void removeItemAt(final int anIndex) {
  super.removeItemAt(anIndex);
  disabled_items.remove(anIndex);
}

代码示例来源:origin: eu.agrosense.client/util-swing

@Override
public void removeItemAt(final int anIndex) {
  super.removeItemAt(anIndex);
  disabled_items.remove(anIndex);
}

代码示例来源:origin: org.apache.jmeter/jorphan

@Override
  public void actionPerformed(ActionEvent e) {
    if (choiceList.getItemCount() > 1) {
      choiceList.removeItemAt(choiceList.getSelectedIndex());
      notifyChangeListeners();
    }
  }
}

代码示例来源:origin: org.junit/com.springsource.junit

private void pruneHistory() {
  int historyLength= getPreference("maxhistory", HISTORY_LENGTH);
  if (historyLength < 1)
    historyLength= 1;
  for (int i= fSuiteCombo.getItemCount()-1; i > historyLength-1; i--)
    fSuiteCombo.removeItemAt(i);
}

代码示例来源:origin: org.orbisgis/orbisgis-view

/**
 * User click on delete button.
 */
public void onDeleteWorkspaceEntry() {
  JComboBox combo = comboBox.getComboBox();
  if(combo.getItemCount() != 0 && combo.getSelectedIndex() != -1) {
    combo.removeItemAt(combo.getSelectedIndex());
  }
}

代码示例来源:origin: orbisgis/orbisgis

/**
 * User click on delete button.
 */
public void onDeleteWorkspaceEntry() {
  JComboBox combo = comboBox.getComboBox();
  if(combo.getItemCount() != 0 && combo.getSelectedIndex() != -1) {
    combo.removeItemAt(combo.getSelectedIndex());
  }
}

代码示例来源:origin: net.sf.nachocalendar/nachocalendar

/** Creates new form MonthScroller. */
public MonthScroller() {
  initComponents();
  final DateFormatSymbols symbols = FormatSymbols.getSingletonObject(); //get the formatter
  final String[] months = symbols.getMonths(); //this returns the text form of months
  for (int i = 0; i < months.length - 1; i++) {
    months[i] = months[i].substring(0, 1).toUpperCase() + months[i].substring(1).toLowerCase();
  }
  cMonths.setModel(new DefaultComboBoxModel(months));
  cMonths.removeItemAt(cMonths.getItemCount() - 1);
}

代码示例来源:origin: de.dfki.mary/marytts-client

private void updateSampleTexts() {
  Locale locale = getSelectedLanguage();
  cbInputText.removeAllItems();
  Vector texts = (Vector) sampleTextsByLocale.get(locale);
  assert texts != null;
  if (texts.size() == 0) {
    return;
  }
  for (Iterator it = texts.iterator(); it.hasNext();) {
    String s = (String) it.next();
    cbInputText.addItem(s);
  }
  cbInputText.removeItemAt(0);
  cbInputText.setSelectedIndex(0);
}

代码示例来源:origin: openpnp/openpnp

public void removeCamera(Camera camera) {
  CameraView cameraView = cameraViews.remove(camera);
  if (cameraView == null) {
    return;
  }
  for (int i = 0; i < camerasCombo.getItemCount(); i++) {
    Object o = camerasCombo.getItemAt(i);
    if (o instanceof CameraItem) {
      CameraItem cameraItem = (CameraItem) o;
      if (cameraItem.getCamera() == camera) {
        camerasCombo.removeItemAt(i);
        break;
      }
    }
  }
}

代码示例来源:origin: org.junit/com.springsource.junit

private void addToHistory(final String suite) {
  for (int i= 0; i < fSuiteCombo.getItemCount(); i++) {
    if (suite.equals(fSuiteCombo.getItemAt(i))) {
      fSuiteCombo.removeItemAt(i);
      fSuiteCombo.insertItemAt(suite, 0);
      fSuiteCombo.setSelectedIndex(0);
      return;
    }
  }
  fSuiteCombo.insertItemAt(suite, 0);
  fSuiteCombo.setSelectedIndex(0);
  pruneHistory();
}

代码示例来源:origin: FellowTraveler/otapij

public static void populateComboWithoutAll(Map data, JComboBox component) {
  while (component.getItemCount() > 0) {
    component.removeItemAt(0);
  }
  Set set = data.keySet();
  Iterator iterator = set.iterator();
  while (iterator.hasNext()) {
    Integer key = (Integer) iterator.next();
    component.addItem(new ComboObject(((String[]) data.get(key))[0]));
  }
  if (component instanceof com.moneychanger.ui.custom.SteppedComboBox) {
    Dimension d = component.getPreferredSize();
    component.setPreferredSize(new Dimension(100, d.height));
    ((com.moneychanger.ui.custom.SteppedComboBox) component).setPopupWidth(d.width);
  }
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

@Override
public void removeItemAt(int i) {
  Object o = getItemAt(i);
  removeToolTip(o);
  super.removeItemAt(i);
  setWide(wide); // update width
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

private void initTemplateComboBox() {
  for (JsfTemplateUtils.Template template : JsfTemplateUtils.getTemplates(TemplateType.PAGES)) {
    templatesComboBox.addItem(template);
  }
  // in case of preferred JSP remove other Facelet templates
  JsfPreferences jsfPreferences = JsfPreferences.forProject(project);
  if (!jsfPreferences.isJsfPresent() && jsfPreferences.getPreferredLanguage() != PreferredLanguage.Facelets) {
    for (int i = templatesComboBox.getItemCount() - 1; i >= 0; i--) {
      JsfTemplateUtils.Template template = (JsfTemplateUtils.Template) templatesComboBox.getItemAt(i);
      if (!JsfTemplateUtils.STANDARD_TPL.equals(template.getName())) {
        templatesComboBox.removeItemAt(i);
      }
    }
  }
  templatesComboBox.setRenderer(new JsfTemplateUtils.TemplateCellRenderer());
}

代码示例来源:origin: org.zaproxy/zap

protected void removeCustomSearcher(String name) {
  for (int i = 0; i < getSearchType().getItemCount(); i++) {
    SearchOption option = getSearchType().getItemAt(i);
    if (option.getType() == ExtensionSearch.Type.Custom && name.equals(option.getName())) {
      getSearchType().removeItemAt(i);
      break;
    }
  }
}

代码示例来源:origin: cmu-phil/tetrad

public void itemStateChanged(ItemEvent e) {
    String item = (String) e.getItem();
    int ntileIndex = ntileMap.get(item);
    for (int i = ntileIndexCombo.getItemCount() - 1; i >= 0; i--) {
      ntileIndexCombo.removeItemAt(i);
    }
    for (int n = 1; n <= ntileIndex; n++) {
      ntileIndexCombo.addItem(n);
    }
    double[] breakpoints = getNtileBreakpoints(data, getNtile());
    double breakpoint1 = breakpoints[getNtileIndex() - 1];
    double breakpoint2 = breakpoints[getNtileIndex()];
    field1.setValue(breakpoint1);
    field2.setValue(breakpoint2);
  }
});

代码示例来源:origin: cmu-phil/tetrad

public void itemStateChanged(ItemEvent e) {
    String item = (String) e.getItem();
    int ntileIndex = ntileMap.get(item);
    for (int i = ntileIndexCombo.getItemCount() - 1; i >= 0; i--) {
      ntileIndexCombo.removeItemAt(i);
    }
    for (int n = 1; n <= ntileIndex; n++) {
      ntileIndexCombo.addItem(n);
    }
    double[] breakpoints = getNtileBreakpoints(data, getNtile());
    double breakpoint1 = breakpoints[getNtileIndex() - 1];
    double breakpoint2 = breakpoints[getNtileIndex()];
    field1.setValue(breakpoint1);
    field2.setValue(breakpoint2);
  }
});

相关文章

JComboBox类方法