Hi David,

see pages 128 - 130 in JythonEssentials.
The thing you missed here is: you have to pass the instance (self in your case) to the superclass constructor as well.


package st.extreme.jython;
public class Dialog {
    protected Dialog(String shell) {
        System.out.println("protected Dialog(" + shell + ")");

and then:

Jython 2.2rc1 on java1.6.0_01
Type "copyright", "credits" or "license" for more information.
>>> from st.extreme.jython import Dialog
>>> class GraphDialog(Dialog):
...   def __init__(self, shell):
...     Dialog.__init__(self, shell)
...     print "subclass constructor finished"
>>> gd = GraphDialog("extreme!")
protected Dialog(extreme!)
subclass constructor finished

best wishes,

On 7/5/07, David Huebel < davidhuebel@gmail.com> wrote:
I need to subclass a class has no default or public constructors.  My
code looks something like this:

from org.eclipse.jface.dialogs import *

class GraphDialog(Dialog):

    def __init__(self, shell, columnNames):
        print dir(self)
        #Dialog.__init__(shell)  <-- doesn't work; Dialog's
constructor is protected
        #self.super____init__(shell) <-- doesn't work; super____init__
doesn't exist
        self.columnNames = columnNames

The call to print dir(self) shows that a couple of super__* methods
are defined, but none are constructors.  How do I call the protected


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Jython-users mailing list