|
From: James S. <bit...@ph...> - 2002-02-04 12:55:08
|
Hi all,
firstly, I'm a newbie to both jython and pretty much to java in general (I've done a couple jobs in java, but nothing to write home about),
so my problem might just be something I'm doing wrong.
I have written a small jython application which displayes a swing JTree that is dynamically loaded from a url via a WDDX (XML) packet
for each node (i.e expand a node, application downloads packet, adds nodes to be shown...) . Anyway, the app worked really nicely,
and it was time to turn my application into an applet (which is what I want this particular thing for), easy I thought.
So I just added
class wddxTreeApplet(swing.JApplet):
def init(self) :
getContentPane().add(swing.JScrollPane(wddxTree("Root Of Tree", "http://mortimer/
~boffin/treeViewDumper.cfm")))
to the file wddxTreeApplet.cfm that has all the required classes in it (aside from the supporting 3rd party ones which are in a couple of
jars) ran jythonc over it to produce class files, shifted the class files into an appropriate location and write a dumm html page with an
applet to call it . Didn't work, the java console tells me this...
java.lang.ClassCastException: wddxTreeApplet
at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1178)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:127)
at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:123)
at java.lang.Thread.run(Thread.java:484)
Ok, so I figured I'd better check that applets are working in my browser still, head over o the jython applet demos, yep - alll still work. So,
I take the code for the HelloWorld applet as on the jython applets main page (there's a missing comma in that code as displayed btw)
because I know that works, put it into a jython file called testApplet.py as
from java.applet import Applet
class testApplet(Applet):
def paint(self, g):
g.drawString("Hello from Jython!", 20, 30)
compile with jythonc, move classes (well, everything in jpywork directory) to approprioate place, write an html file, test it, and still doesn't
work...
java.lang.ClassCastException: testApplet
at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1178)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:127)
at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:123)
at java.lang.Thread.run(Thread.java:484)
same error it seems.
So what am I doing wrong ? Is it my jre/jdk (blackdown linux 1.3.1, using plugin under both mozilla and opera with same results) ? Have
I missed some vital step ?
BTW: jython rocks, even if I can't get my own applets working :-)
---
James Sleeman
|