Adding wav sound into a JLabel.
Hi! This is my code. Apparently there is something wrong as my something.wav cannot be detected. Can anyone alter the code for me? BTW, I am adding the sound into JPanel and not JLabel.
Clip clip;
AudioInputStream sam;
File file = new File("PBSS.wav");
try{
sam = AudioSystem.getAudioInputStream(file);
//next part
clip=AudioSystem.getClip();
clip.open(sam);
}
catch (IOException ioe ){ioe.getMessage();}
catch (UnsupportedAudioFileException uafe){uafe.getMessage();}
//next part
catch (LineUnavailableException lue){lue.getMessage();}
catch (SecurityException se){se.getMessage();}
catch (IllegalArgumentException iae) {iae.getMessage();}
}
// I need help as PBSS.wav is undetectable at runtime. It is stored in the package resources.