This patch (committed) adds some missing API docs in JList:
2006-05-03 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/JList.java: Added/updated API docs.
Regards,
Dave
Index: javax/swing/JList.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.53
diff -u -r1.53 JList.java
--- javax/swing/JList.java 29 Apr 2006 19:53:42 -0000 1.53
+++ javax/swing/JList.java 3 May 2006 16:12:56 -0000
@@ -965,11 +965,19 @@
int visibleRowCount;
/**
- * Fire a [EMAIL PROTECTED] ListSelectionEvent} to all the registered
ListSelectionListeners.
+ * Fire a [EMAIL PROTECTED] ListSelectionEvent} to all the registered
+ * ListSelectionListeners.
+ *
+ * @param firstIndex the lowest index covering the selection change.
+ * @param lastIndex the highest index covering the selection change.
+ * @param isAdjusting a flag indicating if this event is one in a series
+ * of events updating the selection.
*/
- protected void fireSelectionValueChanged(int firstIndex, int lastIndex,
boolean isAdjusting)
+ protected void fireSelectionValueChanged(int firstIndex, int lastIndex,
+ boolean isAdjusting)
{
- ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex,
lastIndex, isAdjusting);
+ ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex,
+ lastIndex, isAdjusting);
ListSelectionListener listeners[] = getListSelectionListeners();
for (int i = 0; i < listeners.length; ++i)
{
@@ -1172,6 +1180,8 @@
* #prototypeCellValue} property is set, but setting it explicitly
* overrides the width computed from [EMAIL PROTECTED] #prototypeCellValue}.
*
+ * @param w the width.
+ *
* @see #getFixedCellHeight
* @see #getPrototypeCellValue
*/
@@ -1247,6 +1257,16 @@
return (ListSelectionListener[]) getListeners(ListSelectionListener.class);
}
+ /**
+ * Returns the selection mode for the list (one of:
+ * [EMAIL PROTECTED] ListSelectionModel#SINGLE_SELECTION},
+ * [EMAIL PROTECTED] ListSelectionModel#SINGLE_INTERVAL_SELECTION} and
+ * [EMAIL PROTECTED] ListSelectionModel#MULTIPLE_INTERVAL_SELECTION}).
+ *
+ * @return The selection mode.
+ *
+ * @see #setSelectionMode(int)
+ */
public int getSelectionMode()
{
return selectionModel.getSelectionMode();
@@ -1292,6 +1312,9 @@
* For each element <code>a[i]</code> of the provided array
* <code>a</code>, calls [EMAIL PROTECTED] #setSelectedIndex} on
<code>a[i]</code>.
*
+ * @param a an array of selected indices (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
* @see #setSelectionMode
* @see #selectionModel
*/
@@ -1572,6 +1595,13 @@
setModel(createListModel(listData));
}
+ /**
+ * Returns a [EMAIL PROTECTED] ListModel} backed by the specified array.
+ *
+ * @param items the list items (don't use <code>null</code>).
+ *
+ * @return A list model containing the specified items.
+ */
private ListModel createListModel(final Object[] items)
{
return new AbstractListModel()
@@ -1587,6 +1617,13 @@
};
}
+ /**
+ * Returns a [EMAIL PROTECTED] ListModel} backed by the specified vector.
+ *
+ * @param items the list items (don't use <code>null</code>).
+ *
+ * @return A list model containing the specified items.
+ */
private ListModel createListModel(final Vector items)
{
return new AbstractListModel()
@@ -1683,7 +1720,21 @@
repaint();
}
-
+ /**
+ * Returns the selection model for the [EMAIL PROTECTED] JList} component.
Note that
+ * this class contains a range of convenience methods for configuring the
+ * selection model:<br>
+ * <ul>
+ * <li>[EMAIL PROTECTED] #clearSelection()};</li>
+ * <li>[EMAIL PROTECTED] #setSelectionMode(int)};</li>
+ * <li>[EMAIL PROTECTED] #addSelectionInterval(int, int)};</li>
+ * <li>[EMAIL PROTECTED] #setSelectedIndex(int)};</li>
+ * <li>[EMAIL PROTECTED] #setSelectedIndices(int[])};</li>
+ * <li>[EMAIL PROTECTED] #setSelectionInterval(int, int)}.</li>
+ * </ul>
+ *
+ * @return The selection model.
+ */
public ListSelectionModel getSelectionModel()
{
return selectionModel;
@@ -2038,11 +2089,23 @@
return retVal;
}
+ /**
+ * Returns the index of the anchor item in the current selection, or
+ * <code>-1</code> if there is no anchor item.
+ *
+ * @return The item index.
+ */
public int getAnchorSelectionIndex()
{
return selectionModel.getAnchorSelectionIndex();
}
+ /**
+ * Returns the index of the lead item in the current selection, or
+ * <code>-1</code> if there is no lead item.
+ *
+ * @return The item index.
+ */
public int getLeadSelectionIndex()
{
return selectionModel.getLeadSelectionIndex();
@@ -2074,21 +2137,48 @@
return selectionModel.getMaxSelectionIndex();
}
+ /**
+ * Clears the current selection.
+ */
public void clearSelection()
{
selectionModel.clearSelection();
}
+ /**
+ * Sets the current selection to the items in the specified range
(inclusive).
+ * Note that <code>anchor</code> can be less than, equal to, or greater than
+ * <code>lead</code>.
+ *
+ * @param anchor the index of the anchor item.
+ * @param lead the index of the anchor item.
+ */
public void setSelectionInterval(int anchor, int lead)
{
selectionModel.setSelectionInterval(anchor, lead);
}
+ /**
+ * Adds the specified interval to the current selection. Note that
+ * <code>anchor</code> can be less than, equal to, or greater than
+ * <code>lead</code>.
+ *
+ * @param anchor the index of the anchor item.
+ * @param lead the index of the lead item.
+ */
public void addSelectionInterval(int anchor, int lead)
{
selectionModel.addSelectionInterval(anchor, lead);
}
+ /**
+ * Removes the specified interval from the current selection. Note that
+ * <code>index0</code> can be less than, equal to, or greater than
+ * <code>index1</code>.
+ *
+ * @param index0 an index for one end of the range.
+ * @param index1 an index for the other end of the range.
+ */
public void removeSelectionInterval(int index0, int index1)
{
selectionModel.removeSelectionInterval(index0, index1);