Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 11th, 2012  |  syntax: None  |  size: 0.48 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. private void prepareAudio() {
  2.                 try {
  3.                
  4.                         InputStream is = getClass().getClassLoader().getResourceAsStream("beep.wav");
  5.                         InputStream buffer = new BufferedInputStream(is);
  6.                         inputStream = AudioSystem.getAudioInputStream(buffer);
  7.                 clip = AudioSystem.getClip();
  8.                 clip.open(inputStream);
  9.                
  10.                 } catch (Exception ex) {
  11.                         ex.printStackTrace();
  12.                JOptionPane.showMessageDialog(null, "Houve um problema a preparar o audio do programa!");
  13.             }
  14.                
  15.         }
clone this paste RAW Paste Data