本文整理汇总了Java中javax.swing.DefaultComboBoxModel.removeElement方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultComboBoxModel.removeElement方法的具体用法?Java DefaultComboBoxModel.removeElement怎么用?Java DefaultComboBoxModel.removeElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.DefaultComboBoxModel
的用法示例。
在下文中一共展示了DefaultComboBoxModel.removeElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: btnProjectActionPerformed
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void btnProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProjectActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
int res = chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this));
if (res == JFileChooser.APPROVE_OPTION) {
File fil = chooser.getSelectedFile();
FileObject fo = FileUtil.toFileObject(fil);
if (fo != null) {
try {
Project p = ProjectManager.getDefault().findProject(fo);
DefaultComboBoxModel model = (DefaultComboBoxModel)comProject.getModel();
model.addElement(p);
model.setSelectedItem(p);
if (EMPTY == model.getElementAt(0)) {
model.removeElement(EMPTY);
}
} catch (IOException exc) {
ErrorManager.getDefault().notify(exc);
}
}
}
}
示例2: renameEmulator
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void renameEmulator() {
String oldName = browserCombo.getSelectedItem().toString();
String newEmName = browserCombo.getEditor().getItem().toString();
if (!oldName.equals(newEmName)) {
if (!getTotalBrowserList().contains(newEmName)) {
Emulator emulator = settings.getEmulators().getEmulator(oldName);
emulator.setName(newEmName);
DefaultComboBoxModel combomodel = (DefaultComboBoxModel) browserCombo.getModel();
DefaultComboBoxModel dupCombomodel = (DefaultComboBoxModel) dupDriverCombo.getModel();
int index = browserCombo.getSelectedIndex();
combomodel.removeElement(oldName);
dupCombomodel.removeElement(oldName);
combomodel.insertElementAt(newEmName, index);
dupCombomodel.insertElementAt(newEmName, index);
browserCombo.setSelectedIndex(index);
} else {
Notification.show("Emulator/Browser [" + newEmName + "] already Present");
}
}
}
示例3: renameModule
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void renameModule() {
if (moduleCombo.getSelectedIndex() != -1) {
String moduleName = moduleCombo.getSelectedItem().toString();
String newModuleName = moduleCombo.getEditor().getItem().toString();
if (!newModuleName.trim().isEmpty()) {
testMgmtModule.getModule(moduleName).setModule(newModuleName);
DefaultComboBoxModel combomodel = (DefaultComboBoxModel) moduleCombo.getModel();
int index = moduleCombo.getSelectedIndex();
combomodel.removeElement(moduleName);
combomodel.insertElementAt(newModuleName, index);
moduleCombo.setSelectedIndex(index);
}
}
}