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


Java DefaultListModel.get方法代码示例

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


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

示例1: 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

示例2: 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

示例3: reorderProjects

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private Boolean reorderProjects(TransferHandler.TransferSupport support) {
    JList list = (JList) support.getComponent();
    try {
        int[] selectedIndices = (int[]) support.getTransferable().getTransferData(INDICES);
        DefaultListModel model = (DefaultListModel) list.getModel();
        JList.DropLocation dl = (JList.DropLocation) support.getDropLocation();
        if (dl.getIndex() != -1) {
            for (int selectedIndex : selectedIndices) {
                Object value = model.get(selectedIndex);
                model.removeElement(value);
                model.add(dl.getIndex(), value);
            }
            return true;
        } else {
            LOG.warning("Invalid Drop Location");
        }
    } catch (UnsupportedFlavorException | IOException ex) {
        LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
    return false;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:22,代码来源:InjectScript.java

示例4: canEdit

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
public static boolean canEdit( ListSelectionModel selectionModel, DefaultListModel listModel ) {        
    boolean can =  selectionModel.getMinSelectionIndex() == selectionModel.getMaxSelectionIndex() 
                      && selectionModel.getMinSelectionIndex() != -1;
    if (can) {
        ClassPathSupport.Item item = (ClassPathSupport.Item) listModel.get(selectionModel.getMinSelectionIndex());
        can = item != null && item.canEdit();
    }
    return can;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ClassPathUiSupport.java

示例5: 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

示例6: moveUpButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpButtonActionPerformed
    int[] indexes = displayedGroupsList.getSelectedIndices();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    for (int index : indexes) {
        Object down = displayedModel.get(index - 1);
        Object up = displayedModel.get(index);
        displayedModel.set(index, down);
        displayedModel.set(index - 1, up);
    }
    for (int i = 0; i < indexes.length; i++) {
        indexes[i]--;
    }
    displayedGroupsList.setSelectedIndices(indexes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BreakpointNestedGroupsDialog.java

示例7: moveDownButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownButtonActionPerformed
    int[] indexes = displayedGroupsList.getSelectedIndices();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    for (int index : indexes) {
        Object down = displayedModel.get(index);
        Object up = displayedModel.get(index + 1);
        displayedModel.set(index + 1, down);
        displayedModel.set(index, up);
    }
    for (int i = 0; i < indexes.length; i++) {
        indexes[i]++;
    }
    displayedGroupsList.setSelectedIndices(indexes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BreakpointNestedGroupsDialog.java

示例8: 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


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