File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes The GUI Thread. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "The GUI Thread." Watch "The GUI Thread." New topic

The GUI Thread.

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
My application plays a wav file on wrong password prompted from an InputDialog. The Code is:
import java.applet.Applet;
import java.applet.AudioClip;
public class Snd_Plyr
public Snd_Plyr()
public static void play_snd(final String fname)
Thread thread = new Thread(new Runnable() {
public void run()
URL url = new URL("file", System.getProperty("user.dir"), fname);
AudioClip audioclip = Applet.newAudioClip(url);;
System.out.println("Music Played..");
catch(Exception exception)
System.out.println("Play:" + exception);
I play using
Whenever the user gives a wrong password the sound file is played only for a second & then the main thread starts displaying the InputDialog for the InputDialog is displayd until correct password. write a better code for me Pls.
Happy middling with java.
I agree. Here's the link:
subject: The GUI Thread.
jQuery in Action, 3rd edition