當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。