当前位置: 首页>>代码示例>>Java>>正文


Java DefaultListModel.size方法代码示例

本文整理汇总了Java中javax.swing.DefaultListModel.size方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultListModel.size方法的具体用法?Java DefaultListModel.size怎么用?Java DefaultListModel.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.DefaultListModel的用法示例。


在下文中一共展示了DefaultListModel.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFiles

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void addFiles (final File[] toAddArr, final Set<? super File> invalidRoots) {
    final int[] indecesToSelect = new int[toAddArr.length];
    final DefaultListModel model = (DefaultListModel)this.roots.getModel();
    final File[] relatedFolders = this.relatedFolderList == null ?
        new File[0] : this.relatedFolderList.getFiles();
    for (int i=0, index=model.size(); i<toAddArr.length; i++) {
        File normalizedFile = toAddArr[i];
        if (!isValidRoot(normalizedFile, relatedFolders, this.projectFolder)) {
            invalidRoots.add (normalizedFile);
        }
        else {
            int pos = model.indexOf (normalizedFile);
            if (pos == -1) {
                model.addElement (normalizedFile);
                indecesToSelect[i] = index;
            }
            else {
                indecesToSelect[i] = pos;
            }
            index++;
        }
    }
    this.roots.setSelectedIndices(indecesToSelect);
    this.firePropertyChange(PROP_FILES, null, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:FolderList.java

示例2: collectLibs

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) {
    for (int i = 0; i < model.size(); i++) {
        ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i);
        if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) {
            if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) {
                libs.add(item.getLibrary().getName());
            }
        }
        if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
            if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) {
                //TODO reference is null for not yet persisted items.
                // there seems to be no way to generate a reference string without actually
                // creating and writing the property..
                jarReferences.add(item.getReference());
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:J2SEModularProjectProperties.java

示例3: javaCompletionExcluderDialogOkButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void javaCompletionExcluderDialogOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDialogOkButtonActionPerformed
    JList list = getSelectedExcluderList();
    String text = javaCompletionExcluderDialogTextField.getText();
    DefaultListModel model = (DefaultListModel) list.getModel();
    int index = model.size();
    if (javaExcluderEditing != null){
        // if this was an "edit" rather than "add", then remove the old entry first
        index = model.indexOf(javaExcluderEditing);
        model.remove(index);
        javaExcluderEditing = null;
    }
    String[] entries = text.split(","); // NOI18N
    for (String entry : entries) {
        // strip zero width spaces
        entry = entry.replaceAll("\u200B", "");  // NOI18N
        entry = entry.trim();
        if (entry.length() != 0 && entry.matches(JAVA_FQN_REGEX)){
            model.insertElementAt(entry, index);
            index++;
        }
    }
    updateExcluder(list);
    javaCompletionExcluderDialog2.setVisible(false);
    javaCompletionExcluderDialogTextField.setText(null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:CodeCompletionPanel.java

示例4: updateExcluder

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateExcluder(JList list) {
    DefaultListModel model = (DefaultListModel) list.getModel();
    StringBuilder builder = new StringBuilder();
    for (int i = 0 ; i < model.size() ; i++) {
        String entry = (String) model.getElementAt(i);
        if (builder.length() > 0) {
            builder.append(","); //NOI18N
        }
        builder.append(entry);
    }
    String pref;
    if (list == javaCompletionExcludeJlist)
        pref = JAVA_COMPLETION_BLACKLIST;
    else if (list == javaCompletionIncludeJlist)
        pref = JAVA_COMPLETION_WHITELIST;
    else
        throw new RuntimeException(list.getName());

    preferences.put(pref, builder.toString());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CodeCompletionPanel.java

示例5: removeAgent

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Removes an agent from the start list corresponding to the current network component .
 * 
 * @param networkComponent the NetworkComponent
 */
public void removeAgent(NetworkComponent networkComponent) {

	if (networkComponent == null) {
		return;
	}

	String search4 = networkComponent.getId();
	DefaultListModel<AgentClassElement4SimStart> agentList = this.getAgents2Start();
	int i = 0;
	for (i = 0; i < agentList.size(); i++) {
		AgentClassElement4SimStart agentElement = (AgentClassElement4SimStart) agentList.get(i);
		if (agentElement.getStartAsName().equals(search4)) {
			agentList.remove(i);
			break;
		}
	}

	// Shifting the positions of the later components by 1
	for (int j = i; j < agentList.size(); j++) {
		AgentClassElement4SimStart ac4s = (AgentClassElement4SimStart) agentList.get(j);
		ac4s.setPostionNo(ac4s.getPostionNo() - 1);
	}

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:GraphEnvironmentController.java

示例6: getNewComboBoxModelFilter

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * Gets the ComboBoxModel filter.
 * @return the ComboBoxModel filter
 */
private DefaultComboBoxModel<String> getNewComboBoxModelFilter() {

	Vector<String> filterStrings = new Vector<String>();
	DefaultListModel<ComponentTypeListElement> typeList = this.getListModelComponentTypes();
	for (int i=0; i < typeList.size(); i++) {
		ComponentTypeListElement ctle = typeList.getElementAt(i);
		if (filterStrings.contains(ctle.getDomain())==false) {
			filterStrings.add(ctle.getDomain());
		}
	}
	Collections.sort(filterStrings);
	
	comboBoxModeFilter = new DefaultComboBoxModel<String>();
	comboBoxModeFilter.addElement(AddComponentDialog.NoFilterString);
	for (String filterString : filterStrings) {
		comboBoxModeFilter.addElement(filterString);
	}
	return comboBoxModeFilter;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:24,代码来源:AddComponentDialog.java

示例7: removeProcessorButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void removeProcessorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeProcessorButtonActionPerformed
    DefaultListModel model = (DefaultListModel) annotationProcessorsList.getModel();
    int[] indices = annotationProcessorsList.getSelectedIndices();
    for (int i = indices.length - 1 ; i >= 0 ; i--) {
        model.remove(indices[i]);
    }
    if (!model.isEmpty()) {
        // Select reasonable item
        int selectedIndex = indices[indices.length - 1] - indices.length  + 1; 
        if (selectedIndex > model.size() - 1) {
            selectedIndex = model.size() - 1;
        }
        annotationProcessorsList.setSelectedIndex(selectedIndex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:CustomizerCompile.java

示例8: updateJars

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void updateJars(DefaultListModel model) {
    for (int i = 0; i < model.size(); i++) {
        ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i);
        if (item.getType() == ClassPathSupport.Item.TYPE_JAR) {
            if (item.getReference() != null) {
                item.updateJarReference(uiProperties.getProject().getAntProjectHelper());
            }
        }
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:CustomizerLibraries.java

示例9: applyFilter

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void applyFilter () {
    HgTag selectedBranch = getSelectedTag();
    DefaultListModel targetsModel = new DefaultListModel();
    targetsModel.removeAllElements();
    HgTag toSelect = null;
    String filter = panel.txtFilter.getText();
    synchronized (LOCK) {
        for (HgTag tag : tags) {
            if (applies(filter, tag)) {
                if (selectedBranch != null && tag.getRevisionInfo().getCSetShortID().equals(selectedBranch.getRevisionInfo().getCSetShortID())) {
                    toSelect = tag;
                } else if (parentRevision != null && tag.getRevisionInfo().getCSetShortID().equals(parentRevision.getChangesetId())) {
                    toSelect = tag;
                }
                targetsModel.addElement(tag);
            }
        }
    }
    if (!Arrays.equals(targetsModel.toArray(), ((DefaultListModel) panel.tagList.getModel()).toArray())) {
        panel.tagList.setModel(targetsModel);
        if (toSelect != null) {
            panel.tagList.setSelectedValue(toSelect, true);
        } else if (targetsModel.size() > 0) {
            panel.tagList.setSelectedIndex(0);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:TagManager.java

示例10: applyFilter

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void applyFilter () {
    HgLogMessage selectedRevision = getSelectedRevision();
    DefaultListModel targetsModel = new DefaultListModel();
    targetsModel.removeAllElements();
    HgLogMessage toSelectRevision = null;
    String filter = txtFilter.getText();
    synchronized (LOCK) {
        for (HgLogMessage message : messages) {
            if (applies(filter, message)) {
                if (selectedRevision != null && message.getCSetShortID().equals(selectedRevision.getCSetShortID())) {
                    toSelectRevision = message;
                } else if (parentRevision != null && message.getCSetShortID().equals(parentRevision.getCSetShortID())) {
                    toSelectRevision = message;
                }
                targetsModel.addElement(message);
            }
        }
    }
    if (!Arrays.equals(targetsModel.toArray(), ((DefaultListModel) revisionsComboBox.getModel()).toArray())) {
        revisionsComboBox.setModel(targetsModel);
        if (toSelectRevision != null) {
            revisionsComboBox.setSelectedValue(toSelectRevision, true);
        } else if (targetsModel.size() > 0) {
            revisionsComboBox.setSelectedIndex(0);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ChangesetPickerPanel.java

示例11: applyFilter

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void applyFilter () {
    HgBranch selectedBranch = getSelectedBranch();
    DefaultListModel targetsModel = new DefaultListModel();
    targetsModel.removeAllElements();
    HgBranch toSelect = null;
    String filter = panel.txtFilter.getText();
    synchronized (LOCK) {
        for (HgBranch branch : branches) {
            if (applies(filter, branch)) {
                if (selectedBranch != null && branch.getRevisionInfo().getCSetShortID().equals(selectedBranch.getRevisionInfo().getCSetShortID())) {
                    toSelect = branch;
                } else if (parentRevision != null && branch.getRevisionInfo().getCSetShortID().equals(parentRevision.getChangesetId())) {
                    toSelect = branch;
                }
                targetsModel.addElement(branch);
            }
        }
    }
    if (targetsModel.isEmpty()) {
        targetsModel.addElement(NO_BRANCH);
    }
    if (!Arrays.equals(targetsModel.toArray(), ((DefaultListModel) panel.branchList.getModel()).toArray())) {
        panel.branchList.setModel(targetsModel);
        if (toSelect != null) {
            panel.branchList.setSelectedValue(toSelect, true);
        } else if (targetsModel.size() > 0) {
            panel.branchList.setSelectedIndex(0);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:BranchSelector.java

示例12: getNetworkModel4Component

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
    * This method can be used in order to produce components, by using this 
    * dialog as factory. Just specify the component by the name given in 
    * the ComponentTypeSettings dialog. 
    *
    * @param componentName the map node2 component
    * @return the NetworkModel for the component
    */
   public NetworkModel getNetworkModel4Component(String componentName) {

   	this.getJListComponentTypes().clearSelection();
   	// --- Select the right element from the list ---------------
   	DefaultListModel<ComponentTypeListElement> listModel = this.getListModelComponentTypes();
   	for (int i = 0; i < listModel.size(); i++) {
       	ComponentTypeListElement ctsElement = listModel.get(i);
       	if (ctsElement.getComponentName().equalsIgnoreCase(componentName)) {
       		this.getJListComponentTypes().setSelectedValue(ctsElement, true);
       		break;
       	}
	}
	return this.localNetworkModel;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:23,代码来源:AddComponentDialog.java

示例13: copyFiles

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void copyFiles(final DefaultListModel fileModel, final JTextField txt, JProgressBar bar, Logger log) {
	bar.setMinimum(0);
	bar.setMaximum(fileModel.size() - 1);
	for(int i = 0;i<fileModel.size(); i++) {
		log.Info("COPYING: " + fileModel.getElementAt(i));
		File f = new File(fileModel.getElementAt(i).toString());
		try {
			if(!System.getProperty("os.name").equals("Linux"))
				InstallBuilderWindow.content +=  "Files\\" + Utils.indexOf(fileModel.getElementAt(i).toString(), '\\') + "\n";
			else
				InstallBuilderWindow.content +=  "Files/" + Utils.indexOf(fileModel.getElementAt(i).toString(), '/') + "\n";
			
			if(!System.getProperty("os.name").equals("Linux"))
				FileUtils.copyFile(f, new File(System.getProperty("user.dir") + "\\" + txt.getText() + "\\" + "Files\\" + 
						Utils.indexOf(fileModel.getElementAt(i).toString(), '\\')));
			else
				FileUtils.copyFile(f, new File(System.getProperty("user.dir") + "/" + txt.getText() + "/Files/" + 
						Utils.indexOf(fileModel.getElementAt(i).toString(), '/')));
		} catch (IOException e) {
			e.printStackTrace();
			log.Error("Could not copy file\n" + e);
		}
		bar.setValue(i);
	}
	InstallBuilderWindow.content += "## FILES END ##\n\n## DIRS ##\n";
}
 
开发者ID:JudgeGlass,项目名称:Install_Builder_Universal,代码行数:28,代码来源:ManageFiles.java

示例14: copyDir

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void copyDir(final DefaultListModel dirModel, final JTextField txt, JProgressBar bar, Logger log) {
	bar.setValue(0);
	bar.setMinimum(0);
	bar.setMaximum(dirModel.size() - 1);
	if(dirModel.size() != 0) {
		for(int i = 0;i<dirModel.size(); i++) {
			log.Info("COPYING: <DIR> " + dirModel.getElementAt(i));
			File f = new File(dirModel.getElementAt(i).toString());
			try {
				if(!System.getProperty("os.name").equals("Linux"))
					InstallBuilderWindow.content +=  "Files\\" + Utils.indexOf(dirModel.getElementAt(i).toString(), '\\') + "\n";
				else
					InstallBuilderWindow.content +=  "Files/" + Utils.indexOf(dirModel.getElementAt(i).toString(), '/') + "\n";
				
				if(!System.getProperty("os.name").equals("Linux"))
					FileUtils.copyDirectory(f, new File(System.getProperty("user.dir") + "/" + txt.getText() + "/" + "/Files/" + 
							Utils.indexOf(dirModel.getElementAt(i).toString(), '\\')));
				else
					FileUtils.copyDirectory(f, new File(System.getProperty("user.dir") + "/" + txt.getText() + "/Files/" + 
							Utils.indexOf(dirModel.getElementAt(i).toString(), '/')));
			} catch (IOException e) {
				e.printStackTrace();
				log.Error("Could not copy directory\n" + e);
			}
			bar.setValue(i);
		}
		InstallBuilderWindow.content += "## DIRS END ##\n";
	}else {
		InstallBuilderWindow.content += "\n## DIRS END ##\n";
	}
}
 
开发者ID:JudgeGlass,项目名称:Install_Builder_Universal,代码行数:33,代码来源:ManageDirs.java

示例15: addToAgentList

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
/**
 * This Method transfers a DefaultListModel to
 * the localArrayList 'agentList' which is a
 * type of 'AgentClassElement4SimStart'.
 *
 * @param lm the DefaultListModel that has to be added to the overall agent list
 */
private void addToAgentList(DefaultListModel<AgentClassElement4SimStart> lm) {
	if (lm==null) return;
	for (int i = 0; i < lm.size(); i++) {
		this.agentList.add((AgentClassElement4SimStart) lm.get(i));
	}		
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:14,代码来源:SimulationSetup.java


注:本文中的javax.swing.DefaultListModel.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。