From: Samuele P. <ped...@bl...> - 2002-02-05 03:09:02
|
> >Your .py file must have the same name as > >your class, and watch out for the message from jythonc that your > >python class is extending the java class, JApplet in your case. > > > Ok, I think this is where I am going wrong. The file i want to compile, wddxTreeApplet.py has four top level classes in it - wddxNode > (which extends swing.tree.DefaultMutableTreeNode), wddxTreeModel (extending swing.tree.DefaultTreeModel), wddxTree (extending > swing.JTree) and wddxTreeApplet (extending swing.JApplet). Some of those classes have private classes defined within them (eg > wddxTree includes a definition for class mouseListener(awt.event.MouseAdapter) ). > > Is it OK to have more than one top level class in a jython file to be compiled, or do I have to split those top-level classes into > wddxNode.py, wddxTreeModel.py, wddxTree.py and the existing wddxTreeApplet.py. Presumadly private classes are OK to be defined > within a previous class ? > What about if I want to use a natively written python class (i.e a class not extending any java class/interface), is that simply not possible > (I don't want to at the moment, but seems like it could be annoying to have to extend a java class for every class you want to write) ? > No you can have as many top-level classes as you like, both extending java classes or not. The class with the same name as the file will correspond to the class produced by jythonc (btw the other classes extending java will correspond to inner classes of the main java one (not that much important), the purely python classes have no such correspondence at all). For the rest you should consider that jythonc does a static analysis in order to understand which classes extend java classes, something plain as from javax.swing import JApplet class MyApplet(JApplet): ... import javax.swing class MyApplet(javax.swing.JApplet): ... should work. regards, Samuele Pedroni. |