Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

So what the heck am I supposed to do - evil microsoft

 
Chris Garrison
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Evidently, Microsoft's implementation does not work the same on applets (as does Sun's) with regard to destroy(),stop(), start():


Q: Why does my applet throw a NullPointerException from the AWT Dispatch Event thread?
A: The events that occur during applet startup and shutdown may differ between the Microsoft and Sun implementation of the Java platform. For example, the logic in an applet may rely on the applet being visible when Applet.start()/Applet.stop() is called. That condition may be true when the applet is run on Microsoft's implementation but may not be true on Sun's impelementation.
Applets that rely on specific events that occur during startup and shutdown on Microsoft's implementation of the Java platform may not work properly with JRE/Java Plug-in. The most common symptom of this type of problem is a NullPointerException from the AWT Dispatch Event thread.


I'm trying to call destroy() for an applet on a machine that has the Microsoft runtime engine (and no - downloading sun's version is not a solution).
How can I call "destroy()" in an applet without it moving up the inheritance chain (where the problem lies (microsoft's enging))? Could I somehow get all the code from the Sun Applet.destroy() and 'paste' it in my Applet class and thereby override the method in the super class??? Is that possible? Where could I get it?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean you are trying to call destroy? This is something that the Web browser is supposed to call; you're supposed to override it and add some useful code.
I can tell you right now what's in java.applet.Applet.destroy() -- nothing. It does nothing at all by default. Same with init(), start(), and stop(). They only do something useful if you override them.
Now, that said: what are you really trying to do?
 
Chris Garrison
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This causes an error on machines that don't have the JRE installed. In other words - if you use the Microsoft Virtual machine (please see the initial post (Q/A) you get an error - the Sun virtual machine works fine.
As far as what I'm
"really trying to do:"
...I'm simply trying to NOT have an error when this applet runs on a computer that utilizes the Microsoft Virtual machine. I could care less about calling "destroy." I'm simple trying to follow good programming practices. As I understand, the destroy() method, clears memory/resources on the client.
From the tone of your comments, it would seem that this piece of code were irrelavent and or unecessary. I hope you are right. I keep getting a "NullPointerException from the AWT Dispatch Event thread". Can I eliminate the section of code??
[ October 17, 2003: Message edited by: Chris Garrison11 ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see how the Q/A you've showed is relevant to an error during the destroy() method you're showing; the error that Q/A is talking about has to do with, for instance, Toolkit.createImage() returning null during init() or start() because the Applet's "peer" hasn't been created yet.
Maybe if you cut and pasted the stack trace you're seeing here, I could offer more of an opinion. But I do know that it's by definition unnecessary to call super.anything() in any of the Applet entry point methods (init, start, stop, destroy) so if leaving that out makes your problem go away, then just go right ahead and leave it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic