本文整理汇总了Java中javax.swing.DefaultComboBoxModel.removeAllElements方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultComboBoxModel.removeAllElements方法的具体用法?Java DefaultComboBoxModel.removeAllElements怎么用?Java DefaultComboBoxModel.removeAllElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.DefaultComboBoxModel
的用法示例。
在下文中一共展示了DefaultComboBoxModel.removeAllElements方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePlatforms
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void updatePlatforms() {
final SourceLevelQuery.Result slqr = SourceLevelQuery.getSourceLevel2(prj.getProjectDirectory());
final String sl = slqr.getSourceLevel();
final SourceLevelQuery.Profile profile = slqr.getProfile();
final DefaultComboBoxModel<Object> model = (DefaultComboBoxModel<Object>) platforms.getModel();
model.removeAllElements();
for (J2SERuntimePlatformProvider pp : prj.getLookup().lookupAll(J2SERuntimePlatformProvider.class)) {
for (JavaPlatform jp : pp.getPlatformType(new SpecificationVersion(sl), profile)) {
model.addElement(jp);
}
}
}
示例2: getTableCellEditorComponent
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row, int column) {
ResultSet set = Dao.query("select * from tb_spinfo where gysName='"
+gysName+"'");
DefaultComboBoxModel dfcbm = (DefaultComboBoxModel) getModel();
dfcbm.removeAllElements();
dfcbm.addElement(new TbSpinfo());
try {
while (set.next()) {
TbSpinfo spinfo=new TbSpinfo();
spinfo.setId(set.getString("id").trim());
spinfo.setSpname(set.getString("spname").trim());
spinfo.setCd(set.getString("cd").trim());
spinfo.setJc(set.getString("jc").trim());
spinfo.setDw(set.getString("dw").trim());
spinfo.setGg(set.getString("gg").trim());
spinfo.setBz(set.getString("bz").trim());
spinfo.setPh(set.getString("ph").trim());
spinfo.setPzwh(set.getString("pzwh").trim());
spinfo.setMemo(set.getString("memo").trim());
spinfo.setGysname(set.getString("gysname").trim());
dfcbm.addElement(spinfo);
}
} catch (SQLException e) {
e.printStackTrace();
}
return this;
}
示例3: loadUserTypesCombo
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void loadUserTypesCombo() {
User.UserType ty = (User.UserType) userTypesCombo.getSelectedItem();
User.UserType[] utypes = User.UserType.values();
DefaultComboBoxModel def = (DefaultComboBoxModel) userTypesCombo.getModel();
def.removeAllElements();
for (User.UserType utype : utypes) {
def.addElement(utype);
}
if (ty != null) {
userTypesCombo.setSelectedItem(ty);
}
}
示例4: loadUserLevelCombo
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void loadUserLevelCombo() {
UserLevel ul = (UserLevel) ulevel_combo.getSelectedItem();
DefaultComboBoxModel def = (DefaultComboBoxModel) ulevel_combo.getModel();
def.removeAllElements();
List<UserLevel> userLevelsList = UserController.getUserLevelsList();
for (UserLevel ul1 : userLevelsList) {
def.addElement(ul1);
}
if (ul != null) {
ulevel_combo.setSelectedItem(ul);
}
}
示例5: loadUserLevelCombo_Privileges
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void loadUserLevelCombo_Privileges() {
UserLevel ul = (UserLevel) cmb_user_levels.getSelectedItem();
DefaultComboBoxModel def = (DefaultComboBoxModel) cmb_user_levels.getModel();
def.removeAllElements();
List<UserLevel> userLevelsList = UserController.getUserLevelsList();
for (UserLevel ul1 : userLevelsList) {
def.addElement(ul1);
}
if (ul != null) {
cmb_user_levels.setSelectedItem(ul);
}
}
示例6: loadUsersCombo_Privileges
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void loadUsersCombo_Privileges() {
ArrayList<User> usersList = UserController.getUsersList();
if (usersList.size() > 0) {
DefaultComboBoxModel ucmod = (DefaultComboBoxModel) cmb_users.getModel();
ucmod.removeAllElements();
for (User usr : usersList) {
ucmod.addElement(usr);
}
}
}
示例7: loadUsersList
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void loadUsersList() {
ArrayList<User> usersList = UserController.getUsersList();
DefaultComboBoxModel def = (DefaultComboBoxModel) cmb_user.getModel();
def.removeAllElements();
if (usersList.size() > 0) {
for (User user : usersList) {
if (user.getUserStatus() == 1) {
def.addElement(user);
}
}
}
}
示例8: clearBoxModel
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void clearBoxModel(DefaultComboBoxModel mdl) {
mdl.removeAllElements();
}
示例9: prepareCombo
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
protected void prepareCombo(JComboBox combo, int row, int column){
Feature feature = featureList.get(row);
DefaultComboBoxModel comboModel = (DefaultComboBoxModel)combo.getModel();
comboModel.removeAllElements();
switch(column){
case NAME_COL:
List<String> fNames = new ArrayList<String>();
if(schema != null && schema.getFeatureSchemaSet() != null){
Iterator<FeatureSchema> fSchemaIter = schema.getFeatureSchemaSet().iterator();
while(fSchemaIter.hasNext())
fNames.add(fSchemaIter.next().getFeatureName());
}
if(!fNames.contains(feature.name))fNames.add(feature.name);
Collections.sort(fNames);
for(Iterator<String> nameIter = fNames.iterator();
nameIter.hasNext();
comboModel.addElement(nameIter.next()));
combo.getEditor().getEditorComponent().setBackground(defaultBackground);
combo.setSelectedItem(feature.name);
break;
case VALUE_COL:
List<Object> fValues = new ArrayList<Object>();
if(feature.isSchemaFeature()){
Set<Object> permValues = schema.getFeatureSchema(feature.name).
getPermittedValues();
if(permValues != null) fValues.addAll(permValues);
}
if(!fValues.contains(feature.value)) fValues.add(feature.value);
Collections.sort(fValues, defaultComparator);
for(Iterator<Object> valIter = fValues.iterator();
valIter.hasNext();
comboModel.addElement(valIter.next()));
combo.getEditor().getEditorComponent().setBackground(feature.isCorrect() ?
defaultBackground :
(feature.isRequired() ? REQUIRED_WRONG : OPTIONAL_WRONG));
combo.setSelectedItem(feature.value);
break;
default: ;
}
}