mercredi 15 novembre 2017

Want to print selected/clicked checkbox variable name

I am working with Netbeans GUI development.

I have a checkbox with variable name as cbB2. An itemStateChanged event is registered for the same checkBox:

private void cbB2ItemStateChanged(java.awt.event.ItemEvent evt) {                                      
    System.out.println("Checkbox variable name is " + some_variable);//Output: Checkbox variable name is cbB2
}

All I want to know is the variable name at run-time, when the checkbox is clicked (checked/unchecked). Expected output:

Output: Checkbox variable name is cbB2




Aucun commentaire:

Enregistrer un commentaire