javax.swing.JComboBox#removeAllItems ( )源码实例Demo

下面列出了javax.swing.JComboBox#removeAllItems ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: opensim-gui   文件: EditOneMotionObjectPanel.java
private void populateBodyList(final FrameList frameList, JComboBox comboBox) {
    comboBox.removeAllItems();
    FrameIterator bi = frameList.begin();
    ArrayList<String> frameNames = new ArrayList<String>();
    while(!bi.equals(frameList.end())){
          if (PhysicalFrame.safeDownCast(bi.__deref__())!= null){
              frameNames.add(bi.getName());
          }
         bi.next();
    }
    String[] bNames = new String[frameNames.size()];

    for(int i=0; i<frameNames.size(); i++){
        bNames[i]=frameNames.get(i);
        comboBox.addItem(frameNames.get(i));
    }
    comboBox.setModel(new javax.swing.DefaultComboBoxModel(bNames));
}
 
源代码2 项目: Pixie   文件: BoundingBoxWindow.java
/**
 * Create the proper design for the components representing the object
 * attributes and populate the combo boxes with the data defined in the
 * database.
 *
 * @param selectedNode the list of object attributes, including: the list of
 * types, the list of classes, the list of values
 * @param attribute the combo box for which the attribute is initialized
 */
public void initAttributesComponents(CustomTreeNode selectedNode, JComboBox attribute) {
    if (selectedNode == null) {
        return;
    }

    List<String> typeAttrib = selectedNode.getChildren();

    attribute.removeAllItems();

    if ((typeAttrib != null) && (!typeAttrib.isEmpty())) {
        // set the attributes of the combo boxes
        typeAttrib.stream().forEach(objType -> attribute.addItem(Utils.capitalize(objType)));
    }

    attribute.repaint();
}
 
源代码3 项目: lucene-solr   文件: SortPaneProvider.java
private void resetField(JComboBox<String> fieldCombo, JComboBox<String> typeCombo, JComboBox<String> orderCombo) {
  typeCombo.removeAllItems();
  if (StringUtils.isNullOrEmpty((String) fieldCombo.getSelectedItem())) {
    typeCombo.addItem("");
    typeCombo.setEnabled(false);
    orderCombo.setEnabled(false);
  } else {
    List<SortField> sortFields = searchModel.guessSortTypes((String) fieldCombo.getSelectedItem());
    sortFields.stream()
        .map(sf -> {
          if (sf instanceof SortedNumericSortField) {
            return ((SortedNumericSortField) sf).getNumericType().name();
          } else {
            return sf.getType().name();
          }
        }).forEach(typeCombo::addItem);
    typeCombo.setEnabled(true);
    orderCombo.setEnabled(true);
  }
}
 
源代码4 项目: LoboBrowser   文件: AddressField.java
private void populateCombo(final String comboBoxText) {
  // Expected to be called in GUI thread.
  this.populatingMatches = true;
  try {
    final JComboBox<String> urlComboBox = this;
    urlComboBox.removeAllItems();
    final Collection<String> recentUrls = ComponentSource.getRecentLocations(30);
    for (final String url : recentUrls) {
      urlComboBox.addItem(url);
    }
    this.setText(comboBoxText);
    this.comboHasHeadMatches = false;
    this.comboInvalid = false;
  } finally {
    this.populatingMatches = false;
  }
}
 
源代码5 项目: jplag   文件: OptionPanel.java
private void updateBasecodeCombo() {
	int selindex = 0, numadded = 1;
	JComboBox<String> cb = getJBasecodeCB();
	cb.removeAllItems();
	cb.addItem(Messages.getString("OptionPanel.none")); //$NON-NLS-1$
	
	if(previewSubs == null) return;
	for(int i = 0; i < previewSubs.size(); i++) {
		SubmissionManager sub = previewSubs.get(i);
		if(sub.isValid() && sub.isDirectory()) {
			cb.addItem(sub.name);
			if(sub.name.equals(oldBasecodeDir)) selindex = numadded;
			numadded++;
		}
	}
	cb.setSelectedIndex(selindex);
}
 
源代码6 项目: Shuffle-Move   文件: EditTeamService.java
private void updateKeybindComboBoxes() {
   Team curTeam = getCurrentTeam();
   for (String name : curTeam.getNames()) {
      ItemListener itemListener = nameToItemListenerMap.get(name);
      JComboBox<Character> box = nameToKeybindComboboxMap.get(name);
      box.removeItemListener(itemListener);
      Character prevSelected = box.getItemAt(box.getSelectedIndex());
      box.removeAllItems();
      Character curBinding = curTeam.getBinding(name);
      LinkedHashSet<Character> availableBindings = new LinkedHashSet<Character>(Arrays.asList(curBinding));
      availableBindings.addAll(myData.getAllAvailableBindingsFor(name, curTeam));
      for (Character ch : availableBindings) {
         if (ch != null) {
            box.addItem(ch);
         }
      }
      box.setSelectedItem(prevSelected);
      if (box.getSelectedIndex() < 0) {
         LOG.warning(getString(KEY_NO_BINDINGS));
      }
      box.addItemListener(itemListener);
   }
}
 
源代码7 项目: MeteoInfo   文件: FrmOneDim.java
private void updateEndDimSetS(JComboBox CB1, JComboBox CB2) {
    CB2.removeAllItems();
    for (int i = 0; i < CB1.getItemCount(); i++) {
        CB2.addItem(CB1.getItemAt(i));
    }
    CB2.setSelectedIndex(CB2.getItemCount() - 1);
}
 
源代码8 项目: MeteoInfo   文件: FrmSectionPlot.java
private void updateEndDimSetS(JComboBox CB1, JComboBox CB2) {
    CB2.removeAllItems();
    for (int i = 0; i < CB1.getItemCount(); i++) {
        CB2.addItem(CB1.getItemAt(i));
    }
    CB2.setSelectedIndex(CB2.getItemCount() - 1);
}
 
源代码9 项目: software-demo   文件: FormManagerPanel.java
/**
 * 初始化
 * @param materialsComboBox
 * @param yearComboBox
 * @param monthComBox1 
 * @param monthComBox2
 */
public void init(JComboBox materialsComboBox, JComboBox yearComboBox, JComboBox monthComBox1, JComboBox monthComBox2) {
	//清空
	materialsComboBox.removeAllItems();
	yearComboBox.removeAllItems();
	monthComBox1.removeAllItems();
	monthComBox2.removeAllItems();
	
	List<Materials> materialList = materialsService.getAllMaterialList();
	if(materialList != null) {
		for (Materials materials : materialList) {
			materialsComboBox.addItem(new ComboxVo(materials.getId(), materials.getMaterialsName()));
		}
	}
	
	List<String> years = materialsSellService.getAllYear();
	if(years != null) {
		for (String year : years) {
			yearComboBox.addItem(year);
		}
	}
	
	for (int i = 1; i <= 12; i++) {
		monthComBox1.addItem(i);
		monthComBox2.addItem(i);
	}
}
 
源代码10 项目: tn5250j   文件: SendEMailDialog.java
/**
 * Set the combo box items to the string token from to.
 * The separator is a '|' character.
 *
 * @param to
 * @param boxen
 */
private void setToCombo(String to, JComboBox boxen) {

	StringTokenizer tokenizer = new StringTokenizer(to, "|");

	boxen.removeAllItems();

	while (tokenizer.hasMoreTokens()) {
		boxen.addItem(tokenizer.nextToken());
	}
}
 
源代码11 项目: netbeans   文件: UI.java
public static void setItems(JComboBox comboBox, Object[] items) {
    Object selected = comboBox.getSelectedItem();
    comboBox.removeAllItems();

    for (int i = 0; i < items.length; i++) {
        comboBox.insertItemAt(items[i], i);
    }
    if (items.length > 0) {
        comboBox.setSelectedIndex(0);
    }
    if (selected != null) {
        comboBox.setSelectedItem(selected);
    }
}
 
源代码12 项目: netbeans   文件: ComboBoxTableCellEditor.java
public final void setItems (Object [] items)
{

    JComboBox cb = getComboBox ();
    cb.removeAllItems ();
    final int n = (items != null  ?  items.length  :  0);
    for  (int i = 0; i < n; i++)
    {
        cb.addItem (items [i]);
    }

}
 
源代码13 项目: netbeans   文件: ProfileBaseForm.java
protected void fillKeySize(JComboBox keySizeCombo, boolean publicKey) {
    keySizeCombo.removeAllItems();
    if (publicKey) {
        keySizeCombo.addItem(ComboConstants.NONE);
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_1024);
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_2048);
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_3072);
    } else {
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_128);
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_192);
        keySizeCombo.addItem(ComboConstants.ISSUED_KEYSIZE_256);
    }
}
 
源代码14 项目: netbeans   文件: ProfileBaseForm.java
protected void fillSamlCombo(JComboBox samlVersionCombo) {
    samlVersionCombo.removeAllItems();
    samlVersionCombo.addItem(ComboConstants.SAML_V1010);
    samlVersionCombo.addItem(ComboConstants.SAML_V1011);
    samlVersionCombo.addItem(ComboConstants.SAML_V1110);
    samlVersionCombo.addItem(ComboConstants.SAML_V1111);
    samlVersionCombo.addItem(ComboConstants.SAML_V2011);
}
 
源代码15 项目: netbeans   文件: ProfileBaseForm.java
protected void fillLayoutCombo(JComboBox layoutCombo) {
    layoutCombo.removeAllItems();
    layoutCombo.addItem(ComboConstants.STRICT);
    layoutCombo.addItem(ComboConstants.LAX);
    layoutCombo.addItem(ComboConstants.LAXTSFIRST);
    layoutCombo.addItem(ComboConstants.LAXTSLAST);        
}
 
源代码16 项目: LoboBrowser   文件: ItemListControl.java
public void setItems(final Collection<T> items) {
  final JComboBox<T> comboBox = this.comboBox;
  comboBox.removeAllItems();
  for (final T item : items) {
    comboBox.addItem(item);
  }
}
 
源代码17 项目: keystore-explorer   文件: DialogHelper.java
/**
 * Populate a JComboBox with signature algorithms depending on the key pair type.
 *
 * @param keyPairType
 * @param privateKey
 * @param jcbSignatureAlgorithm
 * @throws CryptoException
 */
public static void populateSigAlgs(KeyPairType keyPairType, PrivateKey privateKey, JComboBox<SignatureType> jcbSignatureAlgorithm)
		throws CryptoException {

	List<SignatureType> sigAlgs;

	switch (keyPairType) {
	case RSA:
		KeyInfo keyInfo = KeyPairUtil.getKeyInfo(privateKey);
		sigAlgs = SignatureType.rsaSignatureTypes(keyInfo.getSize());
		break;
	case DSA:
		sigAlgs = SignatureType.dsaSignatureTypes();
		break;
	case EC:
	default:
		sigAlgs = SignatureType.ecdsaSignatureTypes();
	}

	jcbSignatureAlgorithm.removeAllItems();

	for (SignatureType sigAlg : sigAlgs) {
		jcbSignatureAlgorithm.addItem(sigAlg);
	}

	// pre-select modern hash algs
	if (sigAlgs.contains(SignatureType.SHA256_RSA)) {
		jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_RSA);
	} else if (sigAlgs.contains(SignatureType.SHA256_ECDSA)) {
		jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_ECDSA);
	} else if (sigAlgs.contains(SignatureType.SHA256_DSA)) {
		jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_DSA);
	} else {
		jcbSignatureAlgorithm.setSelectedIndex(0);
	}
}
 
源代码18 项目: zap-extensions   文件: DialogAddAlertFilter.java
private void resetScopeCombo() {
    JComboBox<String> scopeCombo = getScopeCombo();
    scopeCombo.removeAllItems();
    scopeCombo.addItem(SCOPE_GLOBAL);
    for (Context context : Model.getSingleton().getSession().getContexts()) {
        scopeCombo.addItem(context.getName());
    }
}
 
源代码19 项目: netbeans   文件: ProfileBaseForm.java
protected void fillWssCombo(JComboBox wssCombo) {
    wssCombo.removeAllItems();
    wssCombo.addItem(ComboConstants.WSS10);
    wssCombo.addItem(ComboConstants.WSS11);    
}
 
源代码20 项目: chipster   文件: Visualisation.java
public static <T> void fillComboBox(JComboBox<T> box, T[] content) {
	box.removeAllItems();
	for (T o : content) {
		box.addItem(o);
	}
}