private int convertLocationToColumn(int x,int y){
  if (cellWidth > 0) {
    if (layoutOrientation == JList.VERTICAL) {
      return 0;
    }
    Insets insets=list.getInsets();
    int col;
    if (isLeftToRight) {
      col=(x - insets.left) / cellWidth;
    }
 else {
      col=(list.getWidth() - x - insets.right- 1) / cellWidth;
    }
    if (col < 0) {
      return 0;
    }
 else     if (col >= columnCount) {
      return columnCount - 1;
    }
    return col;
  }
  return 0;
}

private int convertLocationToColumn ( int x , int y ) { if ( cellWidth > 0 ) { if ( layoutOrientation == JList . VERTICAL ) { return 0 ; } Insets insets = list . getInsets ( ) ; int col ; if ( isLeftToRight ) { col = ( x - insets . left ) / cellWidth ; } else { col = ( list . getWidth ( ) - x - insets . right - 1 ) / cellWidth ; } if ( col < 0 ) { return 0 ; } else if ( col >= columnCount ) { return columnCount - 1 ; } return col ; } return 0 ; }
returns the closest column to the passed in location .
