本文整理匯總了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}