title: Java Swing - Drawing markers on JSlider
body: <p>I have a progress bar which inherits from JSlider to provide highlighting functionality. <em>Highlights</em> can be added to the slider at a point (and a Color) and these are then painted onto the control. As follows:</p>
  
  <p><a href="http://img101.imageshack.us/img101/7608/sliderexample.png" rel="nofollow noreferrer">http://img101.imageshack.us/img101/7608/sliderexample.png</a></p>
  
  <p>The problem is that I cannot get the <em>highlights</em> in the right place, they need to be in the same location as the markers. I also do not know how to retrieve the left and right margins to where the markers start and end.</p>
  
  <p>Is there anyway to get the coordinates of each marker? Or perhaps a better way of performing this task?</p>
  
  <p>Many Thanks!</p>