for this purpose you should use synchronized function for synchronized animation and sound withyour events occurred when key pressing.for Synchronize any functions you should use synchronized word before you functions this function is used for play mp3 sound public synchronized void playmusic(String file) {if(sound==0) try{Player p = Manager.createPlayer(file);p.setLoopCount(5);p.start();}catch(IOException e){System.out.println("Error in io : " + e.toString());}catch(MediaException e){System.out.println("Error in media : " + e.toString());} }you should add this function in function that you want played syncronized .public void keypress(){playmusic(file);}for animation you can make any arbitary function like thissyncronized void animation(){x++;group.setTranslation(x,y,z);}this function...