From: Jeff E. <je...@ad...> - 2002-03-15 15:55:10
|
This works for me. No explicit java.lang.Objects in sight. from javax.swing import * class PythonClass: pass pythonInstance = PythonClass() pythonString = 'foo' pythonInt = 3 l = [pythonInstance, pythonString, pythonInt] class MyModel(AbstractListModel): def getElementAt(self, i): return l[i] def getSize(self): return len(l) model = MyModel() jlist = JList(model) frame = JFrame() frame.contentPane.add(jlist) frame.setSize(100,300) frame.show() Perhaps you should post an example that shows your problem. BillWorker 2i wrote: > Let me explain myself! > > In Java if I were to extend AbstractListModel and use an array internalArray > to hold my data internally, then for getElementAt() I could do > internalArray[i]. The object that I get from the array does not need to be > converted to java.lang.Object as it ALWAYS inherits from java.lang.Object > > However, in Jython I have to either > i. ensure that the object that I get from the array (list) is an instance of > java.lang.Object or > ii. wrap the Python object into a wrapper class that inherits from > java.lang.Object > > This is not obivous to a new Jython programmer who has come from Java! > > Ashish > > > > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |