• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closing applets

 
Charlie Boss
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a JApplet which has a close button. Of course the browser window will close when its clicked.. for some reason.. the dispose() function wont work for me.. help please..
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
me too.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm... you may have a problem because JApplet doesn't have a dispose method... it's a method of Window, and JApplet is not a subclass of Window...

So I've tried to get a reference to the browser window... I called getParent() on an Applet to see if I could make it close the browser window and I could not... I could make the applet disappear off the page, however... I think that this is because the browser window is not a Java Frame (unless the browser was implemented in Java) and thus you cannot get a reference to it to call dispose on...

Anyway... why are you trying to close the browser window through the Applet? This does not make any sense because the user can close the Applet and the browser together by closing the browser window itself... Applets were not meant to be used in this way...

-Nate
 
Jonathan W. Brett
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am pretty sure that System.exit(0); will work to close the browser
------------------
Jonathan Brett, SCJP
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm... what browser? System.exit() has thrown a some kind of security exception in every browser I have seen...
 
Umesh Valame
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to override the default sercurity permissions in the java.policy file under C:\Program Files\JavaSoft\JRE\1.3.1_08\lib\security
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic