/** * Removes all of the items from the receiver. * * <p> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void removeAll() { checkWidget(); model.removeAll(); updateFocusIndexAfterItemChange(); adjustTopIndex(); updateScrollBars(); }
/** * Removes the items from the receiver which are between the given zero-relative start and end * indices (inclusive). * * @param start the start of the range * @param end the end of the range * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of * elements in the list minus 1 (inclusive) * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void remove(int start, int end) { checkWidget(); model.remove(start, end); updateFocusIndexAfterItemChange(); adjustTopIndex(); updateScrollBars(); }
/** * Sets the receiver's items to be the given array of items. * * @param items the array of items * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the items array is null * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setItems(String[] items) { checkWidget(); validateMarkup(items); model.setItems(items); updateScrollBars(); }
/** * Sets the text of the item in the receiver's list at the given zero-relative index to the string * argument. This is equivalent to <code>remove</code>'ing the old item at the index, and then * <code>add</code>'ing the new item at that index. * * @param index the index for the item * @param string the new text for the item * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the * list minus 1 (inclusive) * <li>ERROR_NULL_ARGUMENT - if the string is null * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setItem(int index, String string) { checkWidget(); validateMarkup(new String[] {string}); model.setItem(index, string); updateScrollBars(); }
/** * Adds the argument to the receiver's list at the given zero-relative index. * * <p>Note: To add an item at the end of the list, use the result of calling <code>getItemCount() * </code> as the index or use <code>add(String)</code>. * * @param string the new item * @param index the index for the item * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the * list (inclusive) * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> * * @see #add(String) */ public void add(String string, int index) { checkWidget(); model.add(string, index); updateFocusIndexAfterItemChange(); updateScrollBars(); }
@Override public void setFont(Font font) { super.setFont(font); updateScrollBars(); }