import java.applet.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DogButton extends JApplet
{
    AudioClip clip;
    public void init()
    {
        clip = getAudioClip(getCodeBase(), "bark.au");
    	Image image = getImage(getCodeBase(), "dog.gif");
    	ImageIcon icon = new ImageIcon(image);
    	Image rollImage = getImage(getCodeBase(), "dog-roll.gif");
	ImageIcon rollIcon = new ImageIcon(rollImage);
    	Image pressImage = getImage(getCodeBase(), "dog-press.gif");
	ImageIcon pressIcon = new ImageIcon(pressImage);
	JButton button = new JButton("Dog Button", icon);
	button.addActionListener(new ActionListener()
	{
	    public void actionPerformed(ActionEvent ae)
	    {
		clip.play();
	    }
	});
	button.setRolloverIcon(rollIcon);
	button.setPressedIcon(pressIcon);
	button.setVerticalTextPosition(SwingConstants.BOTTOM);
	button.setHorizontalTextPosition(SwingConstants.CENTER);
    	getContentPane().add(button, BorderLayout.NORTH);
	setSize(250, 150);
	System.out.println("Code base is " + getCodeBase());
    }
}
