private void moveLowerThumb(){
  int thumbMiddle=0;
switch (slider.getOrientation()) {
case JSlider.VERTICAL:
    int halfThumbHeight=thumbRect.height / 2;
  int thumbTop=currentMouseY - offset;
int trackTop=trackRect.y;
int trackBottom=trackRect.y + (trackRect.height - 1);
int vMax=yPositionForValue(slider.getValue() + slider.getExtent());
if (drawInverted()) {
trackBottom=vMax;
}
 else {
trackTop=vMax;
}
thumbTop=Math.max(thumbTop,trackTop - halfThumbHeight);
thumbTop=Math.min(thumbTop,trackBottom - halfThumbHeight);
setThumbLocation(thumbRect.x,thumbTop);
thumbMiddle=thumbTop + halfThumbHeight;
slider.setValue(valueForYPosition(thumbMiddle));
break;
case JSlider.HORIZONTAL:
int halfThumbWidth=thumbRect.width / 2;
int thumbLeft=currentMouseX - offset;
int trackLeft=trackRect.x;
int trackRight=trackRect.x + (trackRect.width - 1);
int hMax=xPositionForValue(slider.getValue() + slider.getExtent());
if (drawInverted()) {
trackLeft=hMax;
}
 else {
trackRight=hMax;
}
thumbLeft=Math.max(thumbLeft,trackLeft - halfThumbWidth);
thumbLeft=Math.min(thumbLeft,trackRight - halfThumbWidth);
setThumbLocation(thumbLeft,thumbRect.y);
thumbMiddle=thumbLeft + halfThumbWidth;
slider.setValue(valueForXPosition(thumbMiddle));
break;
default :
return;
}
}

private void moveLowerThumb ( ) { int thumbMiddle = 0 ; switch ( slider . getOrientation ( ) ) { case JSlider . VERTICAL : int halfThumbHeight = thumbRect . height / 2 ; int thumbTop = currentMouseY - offset ; int trackTop = trackRect . y ; int trackBottom = trackRect . y + ( trackRect . height - 1 ) ; int vMax = yPositionForValue ( slider . getValue ( ) + slider . getExtent ( ) ) ; if ( drawInverted ( ) ) { trackBottom = vMax ; } else { trackTop = vMax ; } thumbTop = Math . max ( thumbTop , trackTop - halfThumbHeight ) ; thumbTop = Math . min ( thumbTop , trackBottom - halfThumbHeight ) ; setThumbLocation ( thumbRect . x , thumbTop ) ; thumbMiddle = thumbTop + halfThumbHeight ; slider . setValue ( valueForYPosition ( thumbMiddle ) ) ; break ; case JSlider . HORIZONTAL : int halfThumbWidth = thumbRect . width / 2 ; int thumbLeft = currentMouseX - offset ; int trackLeft = trackRect . x ; int trackRight = trackRect . x + ( trackRect . width - 1 ) ; int hMax = xPositionForValue ( slider . getValue ( ) + slider . getExtent ( ) ) ; if ( drawInverted ( ) ) { trackLeft = hMax ; } else { trackRight = hMax ; } thumbLeft = Math . max ( thumbLeft , trackLeft - halfThumbWidth ) ; thumbLeft = Math . min ( thumbLeft , trackRight - halfThumbWidth ) ; setThumbLocation ( thumbLeft , thumbRect . y ) ; thumbMiddle = thumbLeft + halfThumbWidth ; slider . setValue ( valueForXPosition ( thumbMiddle ) ) ; break ; default : return ; } }
moves the location of the lower thumb , and sets its corresponding value in the slider .
