i have a group of jradiobuttonmenuitem (s). when i select one, the actionPerformed method is always getting called. how do i only call the actionPerformed when it's first selcted.? right now i'm controling it by disabling the selected item, but that doesn't seem ideal.
Greg Brannon
Bartender
Joined: Oct 24, 2010
Posts: 530
posted
0
By design (and thankfully consistently), the actionPerformed() method will be called each time the menu item is selected. What the actionPerformed method DOES when called is under your program's control. What you're trying to do is not completely clear, but you could restrict what the actionPerformed() method does by determining if the menu item is already selected by using the isSelected() method and acting accordingly, OR if you mean that the menu item is only to be selected once, then it seems appropriate that it WOULD be disabled after being selected once. There are many other possibilities, but what I've suggested should suffice until you more completely describe what you're trying to do.
Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795