title: JSlider image behind track
body: <p>I want to put an image (visualization of an audio) behind the JSlider which represents the audioplayer, the process of playing.
  First I tried to overwrite the paint-method of the Slider</p>
  
  <pre><code>public void paintComponent(Graphics g) {
      // Draw the previously loaded image to Component
      g.drawImage(img, 0, -100, null);
      super.paintComponent(g);
  }
  </code></pre>
  
  <p>this worked, but the image is higher than the slider, so my next try was a JLayeredPane, where I put the JSlider above a JLabel with the image. Looks good for the first moment. But I mentioned that I need the image behind the <strong>track</strong> of the slider, not the whole slider. There is space to the left and right. Can anybody tell me a way how to calculate this space? Or the width and offset of the track to the border of the slider? This should run under Windows and MacOs, so different LookAndFeels, so I think hard coded values will not work.
  <a href="http://i.stack.imgur.com/9H3Zg.png" rel="nofollow">Example Slider with background image</a></p>
  
  <p>Thankyou.</p>