This content has been marked as final. Show 4 replies
Let me first thank you for your quick, simple and useful answer....
Just, how to refer to my file in the right directory (My file : Pop.aiff, in the same directory with my Java class),
i tried :
AudioClip plonkSound = new AudioClip("Pop.aiff");
AudioClip plonkSound = new AudioClip("/Pop.aiff");
i get errors..
while when i did :
Image Back = new Image(getClass().getResourceAsStream("Back.jpg"));
i can easily refer to Back.jpg without any error...
Thanks it is Okey ... i put :
AudioClip plonkSound = new AudioClip(getClass().getResource("Pop.aiff").toString());
and it works...
Beware: you will probably want to get in the habit of using
especially when you learn about packages and you start to use them (which you should btw). Using getClass().getResource() works for you right now, but I suggest you attempt to find the javadoc (using Google) that describes this method, as an exercise to help you learn how to find your own information.