本文整理汇总了Java中javax.swing.ComboBoxModel.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBoxModel.getSize方法的具体用法?Java ComboBoxModel.getSize怎么用?Java ComboBoxModel.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ComboBoxModel
的用法示例。
在下文中一共展示了ComboBoxModel.getSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePackageComboBox
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void updatePackageComboBox() {
SourceGroup sourceGroup = (SourceGroup) locationComboBox.getSelectedItem();
if (sourceGroup != null) {
ComboBoxModel model = PackageView.createListView(sourceGroup);
if (model.getSelectedItem() != null && model.getSelectedItem().toString().startsWith("META-INF")
&& model.getSize() > 1) { // NOI18N
model.setSelectedItem(model.getElementAt(1));
}
packageComboBox.setModel(model);
}
}
示例2: selectScopeById
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
/**
* Change the selected scope to one with the specified id. If the id does
* not exist, nothing is changed. When the id is from a CustomScopeProvider
* and it returns an empty scope, the preferred scope is selected.
*
* @see ScopeProvider.CustomScopeProvider
*
* @param id the id of the scope to select
*/
public void selectScopeById(@NonNull String id) {
ComboBoxModel m = scopeCombobox.getModel();
for (int i = 0; i < m.getSize(); i++) {
DelegatingScopeInformation sd = (DelegatingScopeInformation) m.getElementAt(i);
if (sd.getId().equals(id)) {
if (sd instanceof ScopeProvider.CustomScopeProvider) {
Scope s = sd.getScope();
if (s != null
&& s.getFiles().isEmpty()
&& s.getFolders().isEmpty()
&& s.getSourceRoots().isEmpty()) {
selectPreferredScope();
return;
}
}
scopeCombobox.setSelectedItem(sd);
return;
}
}
}
示例3: actionPerformed
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
ComboBoxModel m = this.scopeCombobox.getModel();
ScopeProvider selectedScope = (ScopeProvider) scopeCombobox.getSelectedItem();
Scope scope = selectedScope.getScope();
if (selectedScope instanceof DelegatingCustomScopeProvider) {
showCustomizer((DelegatingCustomScopeProvider) selectedScope, scope);
} else {
for (int i = 0; i < m.getSize(); i++) {
ScopeProvider sd = (ScopeProvider) m.getElementAt(i);
if (sd instanceof DelegatingCustomScopeProvider) {
showCustomizer((DelegatingCustomScopeProvider) sd, scope);
break;
}
}
}
}
示例4: getBindingFiles
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
public List<String> getBindingFiles(){
if (this.chkbxUseBindingFile.isSelected()){
List<String> files = new ArrayList<String>();
ComboBoxModel model = this.cmbBindingFiles.getModel();
int i = model.getSize();
for (int j=0; j < i; j++ ){
files.add((String) model.getElementAt(j));
}
return files;
} else {
return null;
}
}
示例5: findFileTypeIndex
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private int findFileTypeIndex(String fileType, StringComparator comparator) {
ComboBoxModel<?> cbModel = getFileTypesCombo().getModel();
for (int i = 0; i < cbModel.getSize(); i++) {
if (comparator.equals(((FileFilter) cbModel.getElementAt(i)).getDescription(),
fileType)) {
return i;
}
}
return -1;
}
示例6: setScope
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
/**
* Select the scope
*
* @param projectName The name of project or null if find should be
* performed on all projects
*/
public void setScope(String projectName) {
JComboBoxOperator scopeOperator = getScope();
String select_item;
if (projectName == null) {
select_item = Bundle.getStringTrimmed("org.netbeans.modules.refactoring.java.ui.scope.Bundle", "LBL_AllProjects");
} else {
select_item = projectName;
}
ComboBoxModel model = scopeOperator.getModel();
int index = -1;
String dn;
for (int i = 0; i < model.getSize()-1; i++) { /// -1 ... it's custom and it fails
dn = ((org.netbeans.modules.refactoring.spi.impl.DelegatingScopeProvider) model.getElementAt(i)).getDisplayName();
if (dn.indexOf(select_item) != -1) {
index = i;
}
}
scopeOperator.selectItem(index);
}
示例7: showUserPackage
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
final public boolean showUserPackage(){
ComboBoxModel m = libraryCombo.getModel();
for(int i=0; i<m.getSize(); i++){
if(((String)m.getElementAt(i)).equals("User Packages")){
libraryCombo.setSelectedIndex(i);
return true;
}
}
return false;
}
示例8: updateSourceGroupPackages
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void updateSourceGroupPackages() {
SourceGroup sourceGroup = (SourceGroup)locationComboBox.getSelectedItem();
ComboBoxModel model = PackageView.createListView(sourceGroup);
if (model.getSelectedItem()!= null && model.getSelectedItem().toString().startsWith("META-INF")
&& model.getSize() > 1) { // NOI18N
model.setSelectedItem(model.getElementAt(1));
}
packageComboBox.setModel(model);
}
示例9: selectPreferredScope
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void selectPreferredScope() {
ComboBoxModel m = scopeCombobox.getModel();
for (int i = 0; i < m.getSize(); i++) {
DelegatingScopeInformation sd = (DelegatingScopeInformation) m.getElementAt(i);
if (sd.getPosition() >= 0) {
scopeCombobox.setSelectedItem(sd);
return;
}
}
}
示例10: findItemIndex
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
/**
* Finds an item between list items.
*
* @param item a text pattern.
* @param comparator a searching criteria.
* @return an item index.
*/
public int findItemIndex(String item, StringComparator comparator) {
ComboBoxModel<?> model = getModel();
for (int i = 0; i < model.getSize(); i++) {
if (comparator.equals(model.getElementAt(i).toString(), item)) {
return i;
}
}
return -1;
}
示例11: assertModel
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void assertModel (Map<String, String> items, JComboBox combo, List<String> expected) {
ComboBoxModel model = combo.getModel();
assertEquals(expected.size() / 2, model.getSize());
for (int i = 0; i < model.getSize(); ++i) {
assertEquals(expected.get(i * 2), model.getElementAt(i));
assertEquals(expected.get(i * 2 + 1), items.get((String) model.getElementAt(i)));
}
}
示例12: loadSimLimit
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void loadSimLimit(Integer val) {
int value = val.intValue();
ComboBoxModel<Object> model = simLimit.getModel();
for (int i = 0; i < model.getSize(); i++) {
Integer opt = (Integer) model.getElementAt(i);
if (opt.intValue() == value) {
simLimit.setSelectedItem(opt);
}
}
}
示例13: mirrorMRUStrings
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void mirrorMRUStrings() {
ComboBoxModel model = searchComboBox.getModel();
int size = model.getSize();
MRU = new Object[size];
for (int i = 0; i < size; i++) {
MRU[i] = model.getElementAt(i);
}
}
示例14: containsDatabase
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private boolean containsDatabase(String aDatabaseName) {
ComboBoxModel<Database> model = dbComboBox.getModel();
for (int i = 0; i < model.getSize(); i++) {
if (((Database) model.getElementAt(i)).getName().equalsIgnoreCase(aDatabaseName)) {
return true;
}
}
return false;
}
示例15: updatePackageComboBox
import javax.swing.ComboBoxModel; //导入方法依赖的package包/类
private void updatePackageComboBox() {
SourceGroup sourceGroup = (SourceGroup) cmbLocation.getSelectedItem();
if (sourceGroup != null) {
ComboBoxModel model = PackageView.createListView(sourceGroup);
if (model.getSelectedItem() != null && model.getSelectedItem().toString().startsWith("META-INF") && model.getSize() > 1) { // NOI18N
model.setSelectedItem(model.getElementAt(1));
}
cmbPackage.setModel(model);
}
}