Fw: Reload the visad applet of html but can't show
James Kelly
J.Kelly at bom.gov.au
Sun Jan 7 16:17:38 MST 2007
Hi Monica,
It is interesting to see another meteorological service looking VisAD...
Have a read through Sun's tutorial page on applet life cycles if you
haven't already:
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
For example its important that your initialisation be done in the "init"
method (eg creating displays), and cleaned up in the "destroy" method of
the applet.
Further, it looks like there are some tricks to using swing in an
applet. Following the Sun tutorial:
http://java.sun.com/docs/books/tutorial/deployment/applet/containerMethods.html
I created the attached "VisadSimple.java" and a trivial html page
"VisadSimple.html" for running it in appletviewer or a web page. This
simple visad program is a 2D display based on Test72, the Streamline
display example program.
I then found that how well this worked (ie the reloading) depended on my
environment. I found at least 1 environment were it worked every time!
(Running Java 1.4.2 on IBM/AIX and using appletviewer to do the reloading).
Using Firefox/Linux/Java 1.4.2_07 it worked about 2/3s of the time
(showing a blank wireframe display the other third of the time).
There are a number of bug reports which seem to be related to this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5099332
http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=52b8202137e5a2bca2b94e78b:YfiG?bug_id=4879990
So, assuming my example code is right, it might require some research to
find an appropriate browser/plugin that works reliably enough for you.
Cheers,
James
PS: For those interested, here's the (crude) procedure I used to
compile/test the code (adding the compiled code to visad.jar):
javac VisadSimple.java
jar -uvf visad.jar VisadSimple*.class
appletviewer VisadSimple.html
monica wrote:
> Hi Santi :
> Thanks you can spent time to answer my question....
> But I have no sense in "implement the method destroy or stop of the
> applet and clean there the current information displayed".
> I try to add void stop() and destroy() methods in my applet, but I
> still don't know write code in those code..
> May I use display.stop() ? display.destroy() ? What code I can use it
> ? It confuse me..
> Even I use these code in my applet like this :
> public void stop()
> {
> System.out.println("stop");
>
> try
> {
> remove(display.getComponent());
> display.removeAllReferences();
> display.clearMaps();
> display = null;
> }
> catch(Exception ex)
> {
> }
> }
> }
> It doesn't help me to solve my big problem... sad :(
> Where I can find resource ? Is any applet example when I reload applet
> could show correct view...?
> Thanks lot~~
> By monica
--
James Kelly
Meteorological Systems Section Bureau of Meteorology
PO Box 1289K Melbourne 3001, Australia
Phone: 61-3-9669-4724 Fax: 61-3-9669-4128 Email: J.Kelly at bom.gov.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VisadSimple.java
Type: text/x-java
Size: 4045 bytes
Desc: not available
Url : http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20070108/77f6c6fd/attachment.bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20070108/77f6c6fd/attachment.html
More information about the visad
mailing list