From: Ype K. <yk...@xs...> - 2002-04-06 08:03:16
|
Jiger, >Hi all, > I am writting a script in Jython which uses swing etc in it. I am creating a JList object & assigning actionPerformed to it but jython gives me this error. > > TypeError: can't set arbitrary attribute in java instance: actionPerformed > > My code creating the jlist obj is like this > > self.jlist = swing.JList(actionPerformed=self.onefileselection); > > & onefileselection is defined in the same class like this > > def onefileselection(self,event): > self.openFile(self,event.source.selectedValue); > > I dont see anything wrong & infact if I assign the same actionPerformed syntax to a JTextField it works fine. But not with JList or JComboBox etc. > > Is there anything am missing. I think the same thing came up on comp.lang.python a bit more than a month ago. The problem might be that the JComboBox has another type signature for it's actionPerformed. The workaround was to explicitly set the actionPerformed attribute, much like one would do in Java. Someone else gave the correct reply, I don't remember whom. You might look for python and JComboBox (or was it a JButton there?) in google. Regards, Ype -- |