Jython question concerning actionPerformed

Delaney, Timothy tdelaney at avaya.com
Mon Feb 4 17:51:04 EST 2002


> From: mishre at hushmail.com [mailto:mishre at hushmail.com]
> 
> I have the following code in Jython running on JDK 1.4, which looks
> like it should work, but isn't:
> 
> def actionPerformed(self,event):
>     if event.getActionCommand() == "Exit":
>         java.lang.System.exit(0)
>     elif event.getActionCommand() == "comboBoxChanged":
>         print event
> 
> Then later on I have:
> 
> self.catCombo = 
> javax.swing.JComboBox(actionPerformed=self.actionPerformed)
> 
> I'm trying to update a JList when the selected item in the JComboBox
> is changed.  If I use the code above I get the following error when I
> run the program:
> 
> "TypeError: can't assign to this attribute in java instance:
> actionPerformed"

There are particular problems with JComboBox and actionPerformed.

http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/541301

Tim Delaney




More information about the Python-list mailing list