• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

closing applet by clicking button

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to close an applet with click of a button.I tried with system.exit and dispose .Both of them failed.how to do this???
thanks
Srikanth narra
 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, an applet can't stand-alone, so it is not possible to close it. Are you mistaken an applet for an application? The closest solution I can think of is as follows:
Create an applet and embed that applet in an html page. Within that applet include a button. When this button is pressed have a window popup (still part of the original applet) and add whatever functionality you want in your "stand-alone" applet into that pop-up frame. Within this frame you can have a button, that when pressed disposes of the frame. That's the best I can offer.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it would be easier to include a button on the web page that pops up a window that contains the applet. In the popup window you can have a button that closes the window.
You can see an example on the Web at http://www.nhn.ou.edu/~walkup/demonstrations/WebAssignments/HarmonicMotion001E.htm . Notice that the "Applet Help" button pops up a window containing some text and a "Close" button. The "Open Applet" button, on the other hand, pops up a window containing an applet. Installing a similar "Close" button on the applet window would be very easy.
Try it and see if this is the kind of functionality you are looking for.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi srikanth,
I used javascript to achieve this and its easier than it seems.
Here are the steps:
import netscape.javascript.*;
//in the actionlistener for the "close" button call destroy()
//in destroy after doing all your cleanup call
JSObject.getWindow(this).eval("javascript:shutDown()");
//the above code will call the javascript function shutDown which should be defined in the <head></head> of your html containing your applet tags.. hope this helps
oh yeah.. in your applet tags you must have this parameter..
<PARAM NAME="MAYSCRIPT" VALUE="true">


[This message has been edited by Charlie Boss (edited July 06, 2001).]
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic