I tested it out, and it's not so much the row of what you click on, but the size of the directory which you enter.
This patch isn't enough, because the problem is also that the visible row count never gets set. When you go into a directory with fewer than 8 elements, this array tries to iterate over all 8 visible rows, except that with (e.g. 2 elements) there are only 2 visible rows. It seems that what we need is something that sets the visible row count correctly. Alternatively, change the oob check to gridY2 < Math.min(visibleRowCount, list.getModel().getSize()) Also, indexToLocation needs to be modified similarly, since it makes the same mistake as locationToIndex. And actually, now that I look at it, I think that list.getModel().getSize() is more correct. Well, now that I say that, it would be more correct still to use cellHeights.length (faster). Actually, Math.min(visibleRowCounts2, cellHeights.length) would probably be both most optimal and most correct. Thanks, -Chris On 01/03, Roman Kennke wrote: > The attached patch helps avoiding an ArrayIndexOutOfBoundsException in > the BasicListUI. > > 2006-01-03 Roman Kennke <[EMAIL PROTECTED]> > > * javax/swing/plaf/basic/BasicListUI.java > (locationToIndex): Added check to avoid ArrayOutOfBoundsException. > > /Roman > _______________________________________________ > Classpath-patches mailing list > Classpath-patches@gnu.org > http://lists.gnu.org/mailman/listinfo/classpath-patches -- "Let us endeavor so to live that when we come to die even the undertaker will be sorry." -- Mark Twain, "Pudd'nhead Wilson's Calendar" ========== Evil Overlord Quote of the Day (www.eviloverlord.com) ========= 172. I will allow guards to operate under a flexible work schedule. That way if one is feeling sleepy, he can call for a replacement, punch out, take a nap, and come back refreshed and alert to finish out his shift. _______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches