• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to dispose of native components?  RSS feed

 
Ryan Taubert
Greenhorn
Posts: 7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I get errors when trying to exit my JFrame without playing the youtube video I have set it to load. I've never learned how to properly dispose the connection, Anyone teach me?

My Code:


If it's relevant the error:
 
Randall Twede
Ranch Hand
Posts: 4696
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't know much about your exact problem, but it is a common problem. most likely you should have a WindowListener(probably an inner class) that cleans up when the user closes the frame "unexpectedly".
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Randall has it exactly right. Code which I wrote which uses that same native component:



(The "shutdown" method calls code to clean up other things in my application, but NativeInterface.close() is what you want to be called.)

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!