title: In java, how do i obtain the value by which the slider changed?
body: <p>I have a <code>JSlider</code> with a minimum of 0 and maximum of 100. Its current value is 0.</p>
  
  <p>At runtime how do I get every value that slider is moved across? For example, with my current code if I change the slider very fast from 0 to 16, it shows like output like: </p>
  
  <pre><code>0
  1
  2
  3
  4
  7
  16
  </code></pre>
  
  <p>It skipped 8 to 15 because I moved the slider directly from 7 to 16 very fast. But I do not want that to happen. I want each and every value to be printed that the slider came across in its movement.</p>
  
  <p>I also want the program to capture the last value the slider took in its movement. </p>
  
  <p>This is my code:</p>
  
  <pre><code>p1.addChangeListener(new ChangeListener() 
  { 
     @Override public void stateChanged(ChangeEvent e) 
     { 
        if (p1.getValueIsAdjusting())
        { 
          System.out.println(p1.getValue()); 
        } 
     } 
  });
  </code></pre>
  
  <p>Can anyone explain why this isn't printing every value?</p>