omg i thought i finished everything, i forgot the sound files for the program.
heres a code in a method that returns an ImageIcon using Class loader and getResource(<Strig
/** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { java.net.URL imgURL = HighScoreUserWindow.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); } else { System.err.println("Couldn't find file: " + path); return null; } }
and i was attempting the same approach for locating .au files, but i just keep getting errors like i cant return the audioStream object
public AudioStream getAudioStream(String path) { InputStream iStream = SoundEffectSample.class.getResourceAsStream(path); AudioStream aStream; try { aStream = new AudioStream(iStream); } catch (IOException ex) { Logger.getLogger(SoundEffectSample.class.getName()).log(Level.SEVERE, null, ex); } return aStream; }
i was searching on google, but i cant find anything that can help me with this, i just want to know, how would this kind of approach be possible , thanks again