Skip to content
Advertisement

determine identification of a JCheckBox in itemListener

I have 4 check boxes, and the user can select or deselect them for their required settings, however, the program requires at least 1 check box to be checked in order to generate the required information for the user. If the user unchecks the last remaining checked box, I want the program to recheck it for them, but in order to do that I need to get the last checkbox that they checked, how might I go about identifying which specific checkbox they checked within the itemListener?

JavaScript

Advertisement

Answer

how might I go about identifying which specific checkbox they checked within the itemListener?

The getSource() method of the ItemEvent will contain the check box:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement