code: public int getXForBeat(int beat) {
          BeatGrid grid = beatGrid.get();
          if (grid != null) {
              return millisecondsToX(grid.getTimeWithinTrack(beat));
          }
          return 0;
      }
docs: Determine the X coordinate within the component at which the specified beat begins.
  
  @param beat the beat number whose position is desired
  @return the horizontal position within the component coordinate space where that beat begins
  @throws IllegalArgumentException if the beat number exceeds the number of beats in the track.