Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 10th, 2003, 06:18 PM
euschenk euschenk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 6 euschenk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
close window with applet

If I am running an applet, after I stop it, how can I close the window it is running in?

thanks.

Reply With Quote
  #2  
Old April 10th, 2003, 09:52 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
Not sure what you mean when you say "after you stop it". How do you stop it?

Anyway, the only way to do anything to the browser that I know of is to use the JSObject object. It gives you an interface to the browser using javascript. Use the eval or call methods.

javadocs

Here is an example of how to use it
Code:
JSObject win = JSObject.getWindow(this);
win.eval("alert(\"Hello world!\");");
win.eval("window.close()");


Though the getWindow method is not listed in that javadocs page, that is the way you get a JSObject object. You cannot call the JSObject constructor. The netscape.javascript package is included with the plugin if a user has it installed you can use it in your applet. However, when doing development you may need to make sure this package is in your classpath. The package is called jaws.jar and it is located in the jre/lib folder of your sdk. You do NOT have to include this jar file with your applet though when you deploy it.

Note, trying to close a window from javascript that was not opened from a browser (by either the window.open() method or a link with a target value) will cause the window to prompt the user if they really want to close the browser.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > close window with applet


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT