3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
6 import javax.swing.JProgressBar;
8 import tim.prune.FunctionLibrary;
9 import tim.prune.function.PlayAudioFunction;
12 * Class to update the supplied progress bar on the basis of
13 * the currently playing audio clip (if any)
15 public class AudioListener implements Runnable, ActionListener
18 private JProgressBar _progressBar = null;
22 * @param inBar progress bar object to update
24 public AudioListener(JProgressBar inBar) {
29 * React to button press
31 public void actionPerformed(ActionEvent inEvent) {
32 new Thread(this).start();
36 * Loop and update progress bar
46 catch (InterruptedException e) {}
47 progress = ((PlayAudioFunction) FunctionLibrary.FUNCTION_PLAY_AUDIO).getPercentage();
48 _progressBar.setVisible(progress >= 0);
49 _progressBar.setValue(progress);