완벽하게 작동하는 음악 플레이어가 있지만 재생/일시 중지 단추를 추가하고 싶습니다. 버튼을 설정했는데 실제로는 클립을 일시 중지하는 코드를 모르겠습니다. 사전에클립을 일시 중지하려면 어떻게합니까? Java
try{
File f = new File("songs/mysong.wav");
Clip clip = AudioSystem.getClip();
AudioInputStream ais = AudioSystem.getAudioInputStream(f);
clip.open(ais);
playing = true;
if(MusicPlayer.pause)
{
clip.stop(); // <- Doesnt stop the song
}
clip.loop(Clip.LOOP_CONTINUOUSLY);
}catch(Exception exception){System.out.println("Failed To Play The WAV File!");}
감사 :
여기 내 코드입니다!