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


Java DefaultListModel.removeAllElements方法代码示例

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


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

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

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

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


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