int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.width - 1;
double min = slider.getMinimum(); if (value < min) value = (int) min; double max = slider.getMaximum(); if (value > max) value = (int) max; double len = trackRect.width; if ((max - min) <= 0.0) return 0; int xPos = (int) ((value - min) / (max - min) * len + 0.5);
  protected int xPositionForValue(int value)  {    int min = slider.getMinimum();    int max = slider.getMaximum();    int len = trackRect.width - 1;    int xPos = (max == min) ? 0 : (value - min) * len / (max - min);    if (! drawInverted())      xPos += trackRect.x;    else      {	xPos = len - xPos;	xPos += trackRect.x;      }    return xPos;  }