Variable JMenubars

I've got a JMenuBar that I want to populate with JMenuItems taken from a variable array, say [20, 30, 50, 70] (these values change every time though). This is fine, I've managed to do that with no problems.

Now I want to add an ActionListener to each of these JMenuItems that will take the number that's printed on the JMenuItem and deliver it somewhere else when it's clicked.

I've been searching the documentation to find a method to do this and I can't. I can't use getText() because I haven't given specific names to the JMenuItems, they're generated anonmously in a for loop.

Please help!

[627 byte] By [chris_uk_83a] at [2007-11-27 11:42:11]
# 1

ActionEvent.getActionCommand()

tjacobs01a at 2007-7-29 17:42:43 > top of Java-index,Desktop,Core GUI APIs...
# 2

You've saved me a lot of time. Thanks!

chris_uk_83a at 2007-7-29 17:42:43 > top of Java-index,Desktop,Core GUI APIs...