Index: javax/swing/JList.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.29
diff -u -r1.29 JList.java
--- javax/swing/JList.java 4 Aug 2005 14:56:05 -0000 1.29
+++ javax/swing/JList.java 17 Aug 2005 18:38:10 -0000
@@ -596,8 +596,7 @@
* @return location of the cell located at the specified index in the list.
*/
public Point indexToLocation(int index){
- //FIXME: Need to implement.
- return null;
+ return getCellBounds(index, index).getLocation();
}
/**
@@ -605,7 +604,7 @@
* address@hidden #visibleRect} property, depending on the address@hidden
* #componentOrientation} property.
*
- * @return The index of the first visible list cell, or -1
+ * @return The index of the last visible list cell, or -1
* if none is visible.
*/
public int getLastVisibleIndex()
@@ -615,7 +614,10 @@
r.translate(0, (int) r.getHeight() - 1);
if (or == ComponentOrientation.LEFT_TO_RIGHT)
r.translate((int) r.getWidth() - 1, 0);
- return getUI().locationToIndex(this, r.getLocation());
+ if (getUI().locationToIndex(this, r.getLocation()) == -1
+ && indexToLocation(getModel().getSize() - 1).y < r.y)
+ return getModel().getSize() - 1;
+ return getUI().locationToIndex(this, r.getLocation());
}
/**