/** * 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"); } }
/** Resume a previously suspended sound file. */ private void resume() { player.resume(); }
/** Stop the currently playing sound file (if there is one playing). */ private void pause() { player.pause(); }
/** Stop the currently playing sound file (if there is one playing). */ private void stop() { player.stop(); }