Java Code Examples for javax.swing.DefaultListModel#removeAllElements()
The following examples show how to use
javax.swing.DefaultListModel#removeAllElements() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectListManager.java From tmc-intellij with MIT License | 6 votes |
public void refreshCourse(String course) { logger.info("Refreshing course {}. @ProjectListManager", course); List<JBList> list = currentListElements.get(course); if (list == null) { return; } for (JBList jbList : list) { if (jbList == null || !jbList.getName().equals(course)) { continue; } DefaultListModel model = (DefaultListModel) jbList.getModel(); model.removeAllElements(); addExercisesToList(new ObjectFinder(), course, model, new CourseAndExerciseManager()); jbList.setModel(model); } refreshAllCourses(); }
Example 2
Source File: SystemPanel.java From megamek with GNU General Public License v2.0 | 6 votes |
private void displayLocations() { DefaultListModel<String> locModel = ((DefaultListModel<String>) locList .getModel()); locModel.removeAllElements(); locModel.insertElementAt( Messages.getString("MechDisplay.AllEquipment"), LOC_ALL_EQUIP); locModel.insertElementAt( Messages.getString("MechDisplay.AllWeapons"), LOC_ALL_WEAPS); locModel.insertElementAt("-----", LOC_SPACER); for (int loc = 0; loc < en.locations(); loc++) { int idx = loc + LOC_OFFSET; if (en.getNumberOfCriticals(loc) > 0) { locModel.insertElementAt(en.getLocationName(loc), idx); } } locList.setSelectedIndex(0); displaySlots(); }
Example 3
Source File: FieldPatternPanel.java From nextreports-designer with Apache License 2.0 | 6 votes |
private void updateNegativesList() { String format = createPattern(); DefaultListModel dlm = (DefaultListModel) negativesList.getModel(); int selected = negativesList.getSelectedIndex(); dlm.removeAllElements(); if (format.indexOf(";") >= 0) { format = format.substring(0, format.indexOf(";")); } String[] formats = new String[5]; formats[0] = format + ";-" + format + ""; formats[1] = format + ";" + format + "-"; formats[2] = format + ";(" + format + ")"; formats[3] = format + ";(-" + format + ")"; formats[4] = format + ";(" + format + "-)"; for (int i = 0; i < formats.length; ++i) { DecimalFormat nf = new DecimalFormat(formats[i]); dlm.addElement(nf.format(-1234.43210)); } if (selected >= 0) { negativesList.setSelectedIndex(selected); } }
Example 4
Source File: TagManager.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example 5
Source File: ChangesetPickerPanel.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example 6
Source File: BranchSelector.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example 7
Source File: ReplaySearch.java From sc2gears with Apache License 2.0 | 5 votes |
/** * Loads the specified replay source file. * @param replaySource replay source file to be loaded */ private void loadReplaySourceFile( final File replaySource ) { try ( final BufferedReader input = new BufferedReader( new InputStreamReader( new FileInputStream( replaySource ), Consts.UTF8 ) ) ) { final DefaultListModel< File > model = (DefaultListModel< File >) sourceList.getModel(); model.removeAllElements(); while ( input.ready() ) model.addElement( new File( input.readLine() ) ); } catch ( final Exception e ) { e.printStackTrace(); GuiUtils.showErrorDialog( Language.getText( "module.repSearch.tab.source.failedToLoadRepSource" ) ); } }
Example 8
Source File: UserBagDialog.java From gameserver with Apache License 2.0 | 5 votes |
public void updateBagStatus() { DefaultListModel listModel = (DefaultListModel)this.bagList.getModel(); listModel.removeAllElements(); List<PropData> propDataList = bag.getOtherPropDatas(); for ( PropData propData : propDataList ) { if ( propData != null ) { listModel.addElement(propData); } } this.currCountTf.setText(""+bag.getCurrentCount()); this.maxCountTf.setText(""+bag.getMaxCount()); }
Example 9
Source File: RemoteTopologyPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public void setRemoteTopology(RemoteTopology remoteTopology) { this.remoteSharedFolderPathTextField.setText(normalizePath(remoteTopology.getRemoteSharedFolderURL())); this.remoteUsernameTextField.setText(remoteTopology.getRemoteUsername()); this.remotePasswordTextField.setText(remoteTopology.getRemotePassword()); this.localSharedFolderPathTextField.setText(normalizePath(remoteTopology.getLocalSharedFolderPath())); DefaultListModel<RemoteMachineProperties> model = (DefaultListModel<RemoteMachineProperties>) this.remoteMachinesList.getModel(); model.removeAllElements(); List<RemoteMachineProperties> remoteMachines = remoteTopology.getRemoteMachines(); for (int i = 0; i < remoteMachines.size(); i++) { model.addElement(remoteMachines.get(i)); } }
Example 10
Source File: FieldPatternPanel.java From nextreports-designer with Apache License 2.0 | 5 votes |
public void setOnlyDate(boolean b) { if (b == true) { DefaultListModel dlm = (DefaultListModel) categoryList.getModel(); dlm.removeAllElements(); dlm.addElement(DATE); selectedCategory = -1; categoryList.setSelectedIndex(0); categoryListValueChanged(null); } }
Example 11
Source File: ListView.java From BotLibre with Eclipse Public License 1.0 | 4 votes |
public void clear(){ DefaultListModel listModel = (DefaultListModel) ((JList)this.component).getModel(); listModel.removeAllElements(); }
Example 12
Source File: ListView.java From BotLibre with Eclipse Public License 1.0 | 4 votes |
public void clear(){ DefaultListModel listModel = (DefaultListModel) ((JList)this.component).getModel(); listModel.removeAllElements(); }
Example 13
Source File: NetworkMonitor.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed DefaultListModel model = (DefaultListModel)request.getModel(); model.removeAllElements(); }
Example 14
Source File: CheckListBox.java From nextreports-designer with Apache License 2.0 | 4 votes |
@Override public void removeAll() { DefaultListModel model = (DefaultListModel) this.getModel(); model.removeAllElements(); }