From: Michael H. <hag...@jp...> - 2002-01-18 14:11:41
|
Hello, Is there a way to access jython's "callable-to-listener" conversion explicitly? I would like to do this: class C: def __init__(self): # ... b = JComboBox(actionPerformed=self.doIt) # ... def doIt(self, e): # ... but it doesn't work because JComboBox (oddly) defines an actionPerformed method. (See http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/541301 for more information.) Is there a way to access jython's "callable-to-listener" conversion explicitly? If so, I could do b = JComboBox(actionListener=jython_coersion(actionPerformed=self.doIt)) which is not quite as terse as the original, but at least better than having to define a python wrapper class to do the trick (and probably a bit faster, too). Ideally this would be spelled b = JComboBox(actionListener=ActionListener(actionPerformed=self.doIt)) but unfortunately this produces an error TypeError: can't instantiate interface (java.awt.event.ActionListener) Thanks, Michael -- Michael Haggerty JPK Instruments hag...@jp... |