hello friend this is the code of my splash screen i want to play a background music when this screen is appears who can i do that i have "hbd.au" file.which i want to play at back ground.I also want to stop the music when it end i.e recursive playback must not happen.
And i also want to know which type of music file can i use at background.
Here is the code of splash screen

import java.awt.*;
import javax.swing.*;

public class bdrsplash extends JWindow implements Runnable
{
	Thread t;
	Image i;
	
	ImageIcon ii;
	
	int x = 0;
	
	bdrsplash()
	{
		t = new Thread( this, "hhh" );
		ii = new ImageIcon( "bdr.png" );
		i = ii.getImage();
		
		setBounds( 150, 150, 640, 480 );
		setVisible( true );
		t.start();
	}
	
	public void run()
	{
		try
		{
			while( x < 600)
			{
				x += 5;
				t.sleep( 100 );
				repaint();
			}
			t.sleep( 500 );
		}catch( Exception e ){}
		//this.setVisible( false );
		this.dispose();
                //call to the other class
		mainscreen me = new mainscreen();
		me.setSize(300,300);
		me.setVisible(true);
		
		
	}
	
	public void paint( Graphics g )
	{
		g.drawImage( i, 0, 0, this );
		g.setColor( Color.BLACK );
		g.drawString( ( x * 100 ) / 600 + "%", 588, 442 );
		g.fillRect( 23,428, x, 20 );
	}
	
	public static void main( String args[] )
	{
		new bdrsplash();
	}
}

Thanx.And have a good day!

For playing sound, you can use the Java Sound API. Specifically, it sounds like the section in this article on Using a Clip is relevant to what you are trying to do.

thanks for your replay but it is very complicated. I found solution on it
here i change i made to play music at background.
i give only changes in the above code.

import javax.sound.sampled.Clip;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.AudioInputStream;
import java.net.*;
....
    try{
          t.sleep(175);//made changes according to your music file time and progress bar
....

public static void main( String args[] )throws Exception
	{
		URL soundLocation = new URL("file:D:/BDRFINAL/happybirthday.au");//url of the file
		Clip clip = AudioSystem.getClip();

    	AudioInputStream inputStream =AudioSystem.getAudioInputStream(soundLocation);
    	clip.open( inputStream );
    	clip.loop(01);//no of loops you want to play 
    	clip.start();
	new bdrsplash();
	}

any buddy want more info. then you serch here
http://groups.google.com.au/group/comp.lang.java.programmer/browse_thread/thread/13d9a3eb6fba4686/21748ebea1ff2f09?#21748ebea1ff2f09
and have other code for play background music

import java.io.File;
import java.io.FileInputStream;
 
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
 
public class PlaySample
{
 
	public static void main(String[] parms)
	{
		try
		{
			AudioStream song = new AudioStream(new FileInputStream(new File("D:\\BDRFINAL\\happybirthday.au")));
			System.out.println("Playing...");
			AudioPlayer.player.start(song);
			//System.out.println("Sleeping...");
			Thread.sleep(11000);
			System.out.println("Stoping...");
			AudioPlayer.player.stop(song);
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
This question has already been answered. Start a new discussion instead.