Results 1 to 4 of 4
- 08-12-2012, 03:46 AM #1
Member
- Join Date
- Aug 2012
- Posts
- 3
- Rep Power
- 0
Closing out of a wav file in a GUI
Hello. I have created a GUI that plays a .wav file. Does anyone know of a simple command to close all files outside of a GUI or to simply reset the entire program to the beginning stage? Here is the code I use to run my song : public void songEngine(){
try {
File yourFile = new File(string);
AudioFormat format;
DataLine.Info info;
Clip clip;
stream = AudioSystem.getAudioInputStream(yourFile);
format = stream.getFormat();
info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
clip.open(stream);
clip.start();
}
catch (Exception e1) {
//whatevers
}
}
}
The button used to stop is an Action listener. So I would need to implement that.
- 08-12-2012, 03:48 AM #2
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: Closing out of a wav file in a GUI
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-12-2012, 03:55 AM #3
Member
- Join Date
- Aug 2012
- Posts
- 3
- Rep Power
- 0
Re: Closing out of a wav file in a GUI
I know how to do the Action Listener, I just don't know how to stop the file from playing.
- 08-12-2012, 09:26 AM #4
Re: Closing out of a wav file in a GUI
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
closing Frame
By twinkle in forum New To JavaReplies: 3Last Post: 07-28-2012, 12:16 PM -
Closing a Port
By dougie1809 in forum NetworkingReplies: 0Last Post: 02-19-2012, 02:56 AM -
Closing a clip
By elamre in forum Java AppletsReplies: 1Last Post: 02-01-2012, 11:43 AM -
Write to File After Closing
By benn22 in forum New To JavaReplies: 3Last Post: 04-12-2011, 11:54 PM -
Closing packages
By uncopywritable in forum New To JavaReplies: 0Last Post: 08-13-2007, 11:47 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks