Java Code Examples for javax.swing.DefaultListModel#ensureCapacity()
The following examples show how to use
javax.swing.DefaultListModel#ensureCapacity() .
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: EditFilterDialog.java From tda with GNU Lesser General Public License v2.1 | 5 votes |
private void addToList(Filter filter) { DefaultListModel dlm = ((DefaultListModel) filterList.getModel()); dlm.ensureCapacity(dlm.getSize() +1); dlm.addElement(filter); filterList.ensureIndexIsVisible(dlm.getSize()); }
Example 2
Source File: PrefManager.java From tda with GNU Lesser General Public License v2.1 | 5 votes |
/** * generate the default filter set. */ private DefaultListModel getPredefinedFilters() { Filter newFilter = new Filter("System Thread Exclusion Filter", ".*at\\s.*", Filter.HAS_IN_STACK_RULE, true, false, false); DefaultListModel filters = new DefaultListModel(); filters.ensureCapacity(2); filters.add(0, newFilter); newFilter = new Filter("Idle Threads Filter", "", Filter.SLEEPING_RULE, true, true, false); filters.add(1, newFilter); return(filters); }
Example 3
Source File: EditCustomCategoryDialog.java From tda with GNU Lesser General Public License v2.1 | 5 votes |
private void addToList(CustomCategory cat) { DefaultListModel dlm = ((DefaultListModel) catList.getModel()); dlm.ensureCapacity(dlm.getSize() +1); dlm.addElement(cat); catList.ensureIndexIsVisible(dlm.getSize()); }
Example 4
Source File: EditCustomCategoryDialog.java From tda with GNU Lesser General Public License v2.1 | 5 votes |
private void moveFilter(JList fromList, JList toList, int selectedItem) { Filter filter = (Filter) ((DefaultListModel) fromList.getModel()).getElementAt(selectedItem); ((DefaultListModel) fromList.getModel()).removeElementAt(selectedItem); DefaultListModel dlm = ((DefaultListModel) toList.getModel()); dlm.ensureCapacity(dlm.getSize() + 1); dlm.addElement(filter); toList.ensureIndexIsVisible(dlm.getSize()); }