public Point indexToLocation(JList list, int index)
public Point indexToLocation(JList l, int index)
  public Point indexToLocation(JList list, int index)  {    int layoutOrientation = list.getLayoutOrientation();    Point loc = null;    switch (layoutOrientation)      {      case JList.VERTICAL:        loc = new Point(0, convertRowToY(index));        break;      case JList.HORIZONTAL_WRAP:        // determine visible rows and cells per row        int visibleRows = list.getVisibleRowCount();        int numberOfCellsPerRow = -1;        if (visibleRows <= 0)          {            Dimension listDim = list.getSize();            numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1);          }        else          {            int numberOfItems = list.getModel().getSize();            numberOfCellsPerRow = numberOfItems / visibleRows + 1;          }        // compute coordinates inside the grid        int gridX = index % numberOfCellsPerRow;        int gridY = index / numberOfCellsPerRow;        int locX = gridX * cellWidth;        int locY = gridY * cellHeight;        loc = new Point(locX, locY);        break;      case JList.VERTICAL_WRAP:        // determine visible rows and cells per column        int visibleRows2 = list.getVisibleRowCount();        if (visibleRows2 <= 0)          {            Dimension listDim2 = list.getSize();            visibleRows2 = listDim2.height / cellHeight;          }        // compute coordinates inside the grid        if (visibleRows2 > 0)          {            int gridY2 = index % visibleRows2;            int gridX2 = index / visibleRows2;            int locX2 = gridX2 * cellWidth;            int locY2 = gridY2 * cellHeight;            loc = new Point(locX2, locY2);          }        else          loc = new Point(0, convertRowToY(index));        break;      }    return loc;  }