Frank,
Thanks for pointing this out.
I'm going to put your code in the next release, which will be released
no later than mid. Feb.
Thank
Wolf
On Jan 24, 2004, at 10:27 AM, Frank Langelage wrote:
Today I found a logical error in method SwingEngine.setActionListener.
The result was, that the menuItems didn't get the the actionListener,
only the Buttons got it.
The reason for this is the following code:
if (!b) {
if (AbstractButton.class.isAssignableFrom( c.getClass() )) {
( (AbstractButton) c ).addActionListener( al );
b = true;
} else if (JMenu.class.isAssignableFrom( c.getClass() )) {
final JMenu m = (JMenu) c;
final int k = m.getItemCount();
for (int i = 0; i < k; i++) {
b = b | setActionListener( m.getItem( i ), al );
}
}
}
A JMenu is also a SubClass of AbstractButton, so the "else if
(JMenu...." is never reached.
I've changed the order of the code blocks above to get it working:
if (!b) {
if (JMenu.class.isAssignableFrom( c.getClass() )) {
final JMenu m = (JMenu) c;
final int k = m.getItemCount();
for (int i = 0; i < k; i++) {
b = b | setActionListener( m.getItem( i ), al );
}
} else if (AbstractButton.class.isAssignableFrom( c.getClass() )) {
( (AbstractButton) c ).addActionListener( al );
b = true;
}
}
I'll hope to see this bug fix in the next version SwiXml 1.0.2.
Regards
Frank
_______________________________________________
Forum mailing list
Forum@carlsbadcubes.com
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
Wolf Paulus
C a r l s b a d C u b e s
mailto:[EMAIL PROTECTED]
CONFIDENTIALITY NOTICE:
This message is intended only for the use of the individual or entity
to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable
law.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.