calculating jslider progress bar in java
<p>hello 
 i am developing an simple java audio player and i need to use jslider as progress bar and i used it while i play the progress bar finishes before the song has been finished i use this code</p>

<pre><code>  Timer time = new Timer(100, new ActionListener() {
              int percent = 0;

            @Override
            public void actionPerformed(ActionEvent e) {
                    percent++;
                    if (percent&gt;100)
                            percent = 0;

                 jSlider1.setValue((int)(100*(percent/600.0*duration)));
            }
    });
    time.start();
</code></pre>
