Jython question concerning actionPerformed
mishre at hushmail.com
Mon Feb 4 13:25:42 CET 2002
I have the following code in Jython running on JDK 1.4, which looks
like it should work, but isn't:
if event.getActionCommand() == "Exit":
elif event.getActionCommand() == "comboBoxChanged":
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:
If I use:
self.catCombo = javax.swing.JComboBox(actionPerformed=self.actionPerformed())
TypeError: actionPerformed() takes at least 2 arguments (1 given)
This is because I have "def actionPerformed(self, event)" but I need
both of them or I can't look at the event.
I've also tried this with the actionPerformed function declared as a
class inheriting java.awt.event.ActionListener, which works a little
better..but then I can't manipulate the self.catCombo item in the main
function (or at least if I can I don't know how).
Does anyone have any ideas on what to try next?
More information about the Python-list