?
Solved

destroying a Frame, from an applet

Posted on 1998-02-17
4
Medium Priority
?
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 140 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month12 days, 7 hours left to enroll

777 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