Re: PlotDigits extends Applet :-(

Hi Bill,

I played around with it, but also could not get it working
as an applet in the visad/examples folder. Unfortunately,
the fact that visad/examples is supposed to be the default
package makes things like this difficult.

I have converted the TestPlotDigits example to use Swing
instead of functioning as an applet (there was no reason the
test needed to be an applet). I put the updated test program
on demedici at ~curtis/TestPlotDigits.java.

I removed the package statement so that it works in the
visad/examples directory. Parameters that used to be
specified in the HTML file can now be given on the command
line instead. So visad/plotdigits.html is obsolete now.

-Curtis

At 01:35 PM 7/27/2004, Bill Hibbard wrote:
>Hi James,
>
>This sounds like a good idea. I was able to get all the
>Applet stuff out of visad/PlotDigits.java into
>visad/TestPlotDigits.java, but I cannot figure out how to
>change visad/plotdigits.html so the test still works.
>Ideally TestPlotDigits.java would go into the visad/examples
>directory, but there TestPlotDigits.java would have to have
>no package statement and I don't know if the Applet can be
>made to work with that.
>
>I've put my new TestPlotDigits.java and PlotDigits.java in:
>
>  ftp://ftp.ssec.wisc.edu/pub/visad-2.0/untested/
>
>Can any Applet experts help?
>
>Thanks,
>Bill
>
>On Tue, 27 Jul 2004, James Kelly wrote:
>
>> Hi All,
>>
>> I've been experimenting with generating graphics without an X display.
>> This means I could create images either as background tasks (from cron)
>> or from within a Java Server Page or servlet.
>>
>> To do this, I start java with the "-Djava.awt.headless=true" option, or
>> use System.SetProperty("*java*.*awt*.*headless*","true") in the code.
>>
>> So far I've been able to generate a simple graphic from a jsp (using a
>> modified version of Ugo's P1_01.java). I can also retrieve data from an
>> ADDE server and plot it as text, save it as an image and embed it in a
>> web page on the fly. Then I tried contouring the data. This produces the
>> exception:
>>
>> java.awt.HeadlessException
>>         at java.applet.Applet.<init>(Applet.java:44)
>>         at visad.PlotDigits.<init>(PlotDigits.java:41)
>>         at visad.Contour2D.contour(Contour2D.java:235)
>>
>> So Contour2D calls PlotDigits and PlotDigits extends Applet, which isn't
>> supported in headless mode. Looking at the code for PlotDigits, the
>> JavaDoc says:
>> "It is implemented as an applet so that it can be
>>    tested graphically with the appletviewer utility."
>>
>> Can this dependency be removed?
>>
>> Cheers,
>>
>> James
>>
>> [this is a resend... earlier message to visad@xxxxxxxxxxxxxxxx didn't
>> seem to work]
>>
>>
>>
>>