Volume Jslider Adjustment lags

Hello.My Jslider volume control seems to lag a bit.The volume doesn't

increase or decrease until just after I make the adjustment.I included

some of my code here.Any help appreciated.

Thank you

public void stateChanged(ChangeEvent e) {

JSlider source = (JSlider)e.getSource();

if (!source.getValueIsAdjusting()) {

int sp = (int)source.getValue();

gainControl = (FloatControl)newClip.getControl(FloatControl.Type.MASTER_GAIN);

int n=-20;

float f = S_MIN + (sp*width/1000.0f);

nf=f * n;

gainControl.setValue(nf);

}

}

public void playAudio30(){

try{

audioInputStream = AudioSystem.getAudioInputStream(soundFile);

audioFormat= audioInputStream.getFormat();;

DataLine.Info dataLineInfo =new DataLine.Info(Clip.class,audioFormat);

newClip = (Clip)AudioSystem.getLine(dataLineInfo);

new PlayThread().start();

}

catch (Exception e) {

e.printStackTrace();

System.exit(0);

}//end catch

}

class PlayThread extends Thread{

public void run(){

try{

//-35 to -0

int cnt;

newClip.open(audioInputStream);

gainControl = (FloatControl)newClip.getControl(FloatControl.Type.MASTER_GAIN);

gainControl.setValue(nf);

if (volinit==true) {

newClip.loop(Clip.LOOP_CONTINUOUSLY);

}

volinit=true;

}

catch (Exception e) {

e.printStackTrace();

System.exit(0);

}//end catch

}

} //end run

}//end playAudio

[1609 byte] By [Java_chicka] at [2007-10-2 21:52:03]
# 1
It turns out there is no problem with this.The volume is adjusted assoon as the mouse is released.If I wanted to finetune it I wouldjust work off the mouse_down event.Considering it's purpose is served I guessit's fine as it is.
Java_chicka at 2007-7-14 1:07:57 > top of Java-index,Security,Cryptography...