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


Java DefaultListModel.remove方法代码示例

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


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

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

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

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
protected void cleanup(JComponent c, boolean remove) {
    if (remove && indices != null) {
        JList source = (JList) c;
        DefaultListModel model = (DefaultListModel) source.getModel();
        // If we are moving items around in the same list, we
        // need to adjust the indices accordingly, since those
        // after the insertion point have moved.
        if (addCount > 0) {
            for (int i = 0; i < indices.length; i++) {
                if (indices[i] > addIndex) {
                    indices[i] += addCount;
                }
            }
        }
        for (int i = indices.length - 1; i >= 0; i--) {
            model.remove(indices[i]);
        }
    }
    indices = null;
    addCount = 0;
    addIndex = -1;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:ListTransferHandler.java

示例4: remove

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void remove(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove
    final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
    final int[] index = sources.getSelectedIndices();
    for (int i=index.length-1; i>=0; i--) {
        lm.remove(index[i]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SelectRootsPanel.java

示例5: moveUp

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveUp(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUp
    final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
    final int[] index = sources.getSelectedIndices();
    for (int i=0; i< index.length; i++) {
        final URI toMove = lm.remove(index[i]);
        lm.add(index[i]-1, toMove);
        index[i]--;
    }
    sources.setSelectedIndices(index);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SelectRootsPanel.java

示例6: moveDown

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void moveDown(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDown
    final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
    final int[] index = sources.getSelectedIndices();
    for (int i=index.length-1; i>=0; i--) {
        final URI toMove = lm.remove(index[i]);
        lm.add(index[i]+1, toMove);
        index[i]++;
    }
    sources.setSelectedIndices(index);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SelectRootsPanel.java

示例7: formattersMoveDownButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void formattersMoveDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_formattersMoveDownButtonActionPerformed
    int index = formattersList.getSelectedIndex();
    if (index < 0) return ;
    DefaultListModel model = (DefaultListModel) formattersList.getModel();
    if (index >= (model.getSize() - 1)) return ;
    Object obj = model.remove(index);
    model.insertElementAt(obj, index + 1);
    formattersList.setSelectedIndex(index + 1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CategoryPanelFormatters.java

示例8: removeSelected

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void removeSelected(JList list, String prefKey) {
    DefaultListModel m = (DefaultListModel)list.getModel();
    while (!list.isSelectionEmpty()) {
        m.remove(list.getSelectionModel().getLeadSelectionIndex());
    }
    updatePreference(list, prefKey);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:UseSpecificCatchCustomizer.java

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

示例10: javaCompletionExcluderRemoveButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed
    JList list = getSelectedExcluderList();
    int[] rows = list.getSelectedIndices();
    DefaultListModel model = (DefaultListModel) list.getModel();
    // remove rows in descending order: row numbers change when a row is removed
    for (int row = rows.length - 1; row >= 0; row--) {
        model.remove(rows[row]);
    }
    updateExcluder(list);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CodeCompletionPanel.java

示例11: addButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
    int[] indexes = availableGroupsList.getSelectedIndices();
    DefaultListModel availableModel = (DefaultListModel) availableGroupsList.getModel();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    int at = displayedModel.getSize();
    for (int i = indexes.length - 1; i >= 0; i--) {
        Object element = availableModel.remove(indexes[i]);
        displayedModel.add(at, element);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:BreakpointNestedGroupsDialog.java

示例12: removeButtonActionPerformed

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
    int[] indexes = displayedGroupsList.getSelectedIndices();
    DefaultListModel availableModel = (DefaultListModel) availableGroupsList.getModel();
    DefaultListModel displayedModel = (DefaultListModel) displayedGroupsList.getModel();
    int at = availableModel.getSize();
    for (int i = indexes.length - 1; i >= 0; i--) {
        Object element = displayedModel.remove(indexes[i]);
        availableModel.add(at, element);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:BreakpointNestedGroupsDialog.java

示例13: jRemoveSelectedOfficeButtonAction

import javax.swing.DefaultListModel; //导入方法依赖的package包/类
private void jRemoveSelectedOfficeButtonAction(java.awt.event.ActionEvent evt) {
    DefaultListModel model = (DefaultListModel) jOfficeSelected.getModel();
    int selectedIndex = jOfficeSelected.getSelectedIndex();
    QOffice officeToRemove = (QOffice) jOfficeSelected.getSelectedValue();
    if (selectedIndex != -1) {
        model.remove(selectedIndex);
    }
    officesToRemove.add(officeToRemove);

    //Remove the office from the "Add" list, if it exists there
    if (officesToAdd.contains(officeToRemove)) {
        officesToAdd.remove(officeToRemove);
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:15,代码来源:FServiceChangeDialod.java


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