Solved

destroying a Frame, from an applet

Posted on 1998-02-17
4
279 Views
Last Modified: 2010-04-16
I have a problem where my applet calls up a Frame, but for some reason destroy() (or i'm writing it wrong) never seems to get called, until Netscape is shut down.  So as you surf around, it's still there taking up resources, etc.  

What will cause the applet's destroy() method to be called?

How do I remove the Frame object?

i'm using 1.0.2 by the way.  thanks
0
Comment
Question by:glow060197
  • 2
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1233120
As far as Netscape is concerned, the destroy() method doesn't need to be called until the object is to be cleaned up.  That will certainly occur when the browser is terminated.  You can try and force the JRE engine to clean up by setting your Frame's class variable to null.

Frame myframe;

// Do stuff here...

// Done with it
myframe = null;

It should do the trick (eventually) but there is no guarantee in all environments.
0
 

Author Comment

by:glow060197
ID: 1233121
I tried myframe=null; already (in destroy() at least).  You know how (under win95) the Frames have little X in upper right?  Well that box won't kill it either.  I've created a super-frame somehow...  Maybe an event-handling trick can be hacked?
0
 
LVL 3

Accepted Solution

by:
gwalters earned 70 total points
ID: 1233122
The X won't kill the frame unless you process Event.WINDOW_DESTROY (which is what you get when they click there).

myframe=null; does absolutely nothing.  You don't have to have a reference to a frame for it to be visible.  Don't beleive me?  Try: (new Frame()).show();



To get rid of it:

myframe.hide();
myframe.dispose();

0
 
LVL 3

Expert Comment

by:gwalters
ID: 1233123
BTW, put that in your applet's stop() method and it will go away when they leave your page (I assume that's where you were putting the destroy()).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now