Hi friends
im new at this topic and i have tried all the things to make it work but without results ..
can you please tell me whats not going in this simple code ??
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package rada; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import javax.swing.*; import sun.audio.*; public class Rada implements ActionListener{ JFrame f = new JFrame("adga"); JButton btt; Rada (){ f.setBounds(100,100,200,200); f.setDefaultCloseOperation(f.EXIT_ON_CLOSE); btt = new JButton("Start"); btt.addActionListener(this); f.add(btt); f.setVisible(true); } public void actionPerformed(ActionEvent ae) { if (ae.getSource()==btt){ String st ="1.wav"; try{ InputStream in = new FileInputStream(st); AudioStream as = new AudioStream(in); AudioPlayer.player.start(as); }catch(IOException e){} } } public static void main(String[] args){ Rada rd =new Rada(); } }
i have tried to copy the file audio 1.wav into the main folder of project and in the src folder too. but it doest works ...
is there any good soul which can help me ??