File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the applet to die on exit...

 
Chris Stewart
Ranch Hand
Posts: 184
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you exit my applet the sounds continue to play. Does anyone know how I can truly exit the applet when a user hits the X?
Example: http://www.isy.vcu.edu/~cstewart/info350/FinalProject.html
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need add a WindowListener to the frame that you pop up from the applet. In the WindowListener's windowClosing() method you will stop whatever thread is playing the sound.
[ July 03, 2003: Message edited by: Nathan Pruett ]
 
Chris Stewart
Ranch Hand
Posts: 184
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sound thread is in a different class than the Applet (and JFrame class). Do you know how I can do this?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the sound thread get started, then? You'll need to modify that class to be able to kill the thread when you need to.
 
Chris Stewart
Ranch Hand
Posts: 184
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thread itself was being created in a Sounds class. So I just moved the creation into my Layout class. That action works great. Thanks for your help!
Here is what I'm working on in case you are interested (beware, the cards don't move yet )
http://www.isy.vcu.edu/~cstewart/info350/FinalProject.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic