Sound Applet refuses to show in any browser


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Sound Applet refuses to show in any browser

Threaded View

  1. #1
    Join Date
    Jan 2007
    Posts
    5

    Sound Applet refuses to show in any browser

    Okay I'm sorry if this has been posted elsewhere but I haven't been able to find it and have been stuck for a long time.

    The problem is I cannot get my applet to work right in any browser

    I'm using jpadpro to write and compile my code. Once its compiled. I used the inbuilt applet tester in the program which works absoluetly fine. I then try to stick it into a html file and load it in my installed browsers (mozilla and ie) and it refuses to load the applet.

    Here is my code:

    Code:
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    
    public class SoundApplet extends JApplet implements ActionListener
    {
    	URL sound; AudioClip music;
    
    	public void init()
    
    	{
    		try
    		{
    			sound = new URL("file:music.wav");
    			music = JApplet.newAudioClip(sound);
    			music.loop();
    		}
    		catch(MalformedURLException error){}
    		Container contentArea = getContentPane();
    		JButton button = new JButton("Click To Stop Sound");
    		button.addActionListener(this);
    		contentArea.add(button);
    	}
    	public void actionPerformed(ActionEvent event)
    	{music.stop();}
    }
    Anyhow I'd be very thankful for any help
    Last edited by the_6th_Monkey; 01-26-2007 at 05:53 AM.

Similar Threads

  1. How to Show WinForm in Browser Like I.E. ??
    By meghalgandhi in forum .NET
    Replies: 3
    Last Post: 07-01-2005, 10:04 AM
  2. Replies: 3
    Last Post: 08-23-2001, 11:01 AM
  3. Replies: 1
    Last Post: 08-16-2001, 08:52 AM
  4. View an applet in browser
    By Theodore in forum java.announcements
    Replies: 1
    Last Post: 01-26-2001, 06:59 AM
  5. Replies: 0
    Last Post: 08-21-2000, 07:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center