JRadioButton itemListener infinite loop

Hi,

I'm new to swing development, here is my problem.

I have a JRadioButton with an itemListener, the listener works fine and it do what it have to do but i need to access to it and to change it's selection mode with the setSelected(boolean b) method and not just with the mouse... and of course, the listener catch the event and do an infinite loop... How can i do to avoid this?

Thanks

[414 byte] By [chamerlinga] at [2007-10-2 4:49:35]
# 1

you may try this:

public void itemStateChanged(ItemEvent e) {

if (e.getStateChange() == ItemEvent.SELECTED) {

//do something

} else {

//do something

}

}

backuppa at 2007-7-16 0:54:11 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...