Solved

Kill an applet, stop? destroy?

Posted on 1998-10-29
8
1,129 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
Comment Utility

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
Comment Utility
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
Comment Utility
Would anybody else have a piece of code to show
me how to impliment rembo's suggestion?
0
 

Author Comment

by:afsac
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:fugitive_2
Comment Utility
do you still need answers afsac??
0
 

Author Comment

by:afsac
Comment Utility
YES! PLEASE, any help would be greatly appreciated.

Thanx

Don
0
 

Accepted Solution

by:
fugitive_2 earned 200 total points
Comment Utility
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
Comment Utility
i'll work with it when I get a chance.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

772 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

10 Experts available now in Live!

Get 1:1 Help Now