if (!slider.isEnabled() || !isDragging) return;  currentMouseX = event.getX(); currentMouseY = event.getY();  slider.setValueIsAdjusting(true);  int thumbMiddle; int thumbPosition; switch (slider.getOrientation()) { case JSlider.VERTICAL: thumbMiddle = thumbRect.height/2; thumbPosition = event.getY()-offset;  int trackTop = trackRect.y; int trackBottom = trackRect.y+(trackRect.height-1); int MaxYValue = yPositionForValue(slider.getMaximum() -slider.getExtent());  if (drawInverted()) trackBottom = MaxYValue; else trackTop = MaxYValue;  thumbPosition = Math.max(thumbPosition, trackTop-thumbMiddle); thumbPosition = Math.min(thumbPosition, trackBottom-thumbMiddle);  setThumbLocation(thumbRect.x, thumbPosition);  thumbMiddle = thumbPosition+thumbMiddle; slider.setValue(valueForYPosition(thumbMiddle)); break; case JSlider.HORIZONTAL: thumbMiddle = thumbRect.width/2; thumbPosition = event.getX()-offset;  int trackLeft = trackRect.x; int trackRight = trackRect.x+(trackRect.width-1); int MaxXValue = xPositionForValue(slider.getMaximum() - slider.getExtent());  if (drawInverted()) trackLeft = MaxXValue; else trackRight = MaxXValue;  thumbPosition = Math.max(thumbPosition, trackLeft-thumbMiddle); thumbPosition = Math.min(thumbPosition, trackRight-thumbMiddle);  setThumbLocation(thumbPosition, thumbRect.y);  thumbMiddle = thumbPosition+thumbMiddle; slider.setValue(valueForXPosition(thumbMiddle)); break; }
super.mouseDragged(event);
		public void mouseDragged(MouseEvent event) 		{			// Return if slider disabled or we're not dragging slider.			if (!slider.isEnabled() || !isDragging)				return;			currentMouseX = event.getX();			currentMouseY = event.getY();			slider.setValueIsAdjusting(true);			int thumbMiddle;			int thumbPosition;			switch (slider.getOrientation()) {				case JSlider.VERTICAL:					thumbMiddle = thumbRect.height/2;					thumbPosition = event.getY()-offset;										int trackTop = trackRect.y;					int trackBottom = trackRect.y+(trackRect.height-1);					int MaxYValue = yPositionForValue(slider.getMaximum()							-slider.getExtent());					if (drawInverted()) trackBottom = MaxYValue;					else trackTop = MaxYValue;						thumbPosition = Math.max(thumbPosition, 							trackTop-thumbMiddle);					thumbPosition = Math.min(thumbPosition, 							trackBottom-thumbMiddle);					setThumbLocation(thumbRect.x, thumbPosition);					thumbMiddle = thumbPosition+thumbMiddle;					slider.setValue(valueForYPosition(thumbMiddle));					break;				case JSlider.HORIZONTAL:					thumbMiddle = thumbRect.width/2;					thumbPosition = event.getX()-offset;										int trackLeft = trackRect.x;					int trackRight = trackRect.x+(trackRect.width-1);					int MaxXValue = xPositionForValue(slider.getMaximum()							- slider.getExtent());					if (drawInverted()) trackLeft = MaxXValue;					else trackRight = MaxXValue;										thumbPosition = Math.max(thumbPosition, 							trackLeft-thumbMiddle);					thumbPosition = Math.min(thumbPosition, 							trackRight-thumbMiddle);					setThumbLocation(thumbPosition, thumbRect.y);					thumbMiddle = thumbPosition+thumbMiddle;					slider.setValue(valueForXPosition(thumbMiddle));					break;			}			if (showTipLabel && tipDialog != null && endLabel != null)			{							Point location = slider.getLocationOnScreen();				location.x += thumbRect.x+TOOLTIP_OFFSET;				location.y += thumbRect.y;									tipDialog.setTipString(						endLabel+" : " + slider.getValue());				tipDialog.setLocation(location);				tipDialog.setVisible(true);			}					}