Solved

Kill an applet, stop? destroy?

Posted on 1998-10-29
8
1,137 Views
Last Modified: 2008-03-04
I have an applet. It works fine. you run the
applet, go to some other page, come back and run
the applet again, and it dosn't work properly.
If you do a shift/reload, the applet will work again
like it is suppose to.  Do I need to "destroy" it when
the user clicks the "done" button so that it will be
fresh next time it is ran?  Use the "stop" function?
If so, would anybody have a small piece of code showing
me how to do this?

Thanx

don
0
Comment
Question by:afsac
  • 5
  • 2
8 Comments
 
LVL 4

Expert Comment

by:rembo
ID: 1226663

You need to override the start()
method.  

When you go to another page, the stop() method is called.
When you come back, the start() method is called.  

Whatever stuff you are doing to start the applet in
init(), you should move to another method and then
call it again from the start() method.  

If you need a little more explanation or a little code
snippet, let me know.


Hope that helps,

-Tony

0
 

Author Comment

by:afsac
ID: 1226664
Yes please, a snippet of code would be greatly appreciated.
Thank you for answer my question.  If you can give me an
example, I'll see if I can get it to work.

thanx

don
0
 

Author Comment

by:afsac
ID: 1226665
Would anybody else have a piece of code to show
me how to impliment rembo's suggestion?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:afsac
ID: 1226666
I really need help on this.  I've messed with init(), start(), stop(), detstroy()
and nothing seems to work.  I need this applet (frame) to die so that when
I come back into it, it starts fresh like a SHIFT RELOAD does.

I've raised the points to 200, I don't have much left but I sure could use
and answer on this....any takeres?

Don
0
 

Expert Comment

by:fugitive_2
ID: 1226667
do you still need answers afsac??
0
 

Author Comment

by:afsac
ID: 1226668
YES! PLEASE, any help would be greatly appreciated.

Thanx

Don
0
 

Accepted Solution

by:
fugitive_2 earned 200 total points
ID: 1226669
declare your applet to implement Runnable.
create a Thread for the applet, at the beginning of the applet class.
initialize that thread in the applets start() function, Thread x = new Thread(this);
using the function Thread.start(), start the thread in the applets start().
in applets stop() function, declare Thread.stop(), and Thread = null
in applets destroy() function, declare Thread.stop() and Thread = null.
This will cause the applet to to call the Threads run function at the applets start() function.
override the Threads run function, this function is what is called at Thread.start();
public void run()  {
} // End run.
in run is where the computing of the applet is put.  
build a simple applet with this idea and see how it works, then implement bigger applets.
let me know if you have any questions.
fugitive_2
0
 

Author Comment

by:afsac
ID: 1226670
i'll work with it when I get a chance.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

789 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