Exemplo n.º 1
0
 /**
  * Play the sound file currently selected in the file list. If there is no selection in the list,
  * or if the selected file is not a sound file, do nothing.
  */
 private void play() {
   String filename = (String) fileList.getSelectedValue();
   if (filename == null) { // nothing selected
     return;
   }
   // slider.setValue(0);
   boolean successful = player.play(new File(AUDIO_DIR, filename));
   if (successful) {
     showInfo(filename + " (" + player.getDuration() + " seconds)");
   } else {
     showInfo("Could not play file - unknown format");
   }
 }
Exemplo n.º 2
0
 /** Resume a previously suspended sound file. */
 private void resume() {
   player.resume();
 }
Exemplo n.º 3
0
 /** Stop the currently playing sound file (if there is one playing). */
 private void pause() {
   player.pause();
 }
Exemplo n.º 4
0
 /** Stop the currently playing sound file (if there is one playing). */
 private void stop() {
   player.stop();
 }