Find out whether or not JCheckBox is selectedpublic void itemStateChanged(ItemEvent ev) { String onOrOff = "off"; if ( check.isSelected() ) onOrOff = "on"; System.out.println("Check box is " + onOrOff);}
Find out which thing in the list has been selectedpublic void valueChanged(ListSelectionEvent lse) { if( !lse.getValueIsAdjusting() ) { String selection = (String) list.getSelectedValue(); System.out.println(selection); }}
JCheckBox
JList
Quer criar suas próprias Notas gratuitas com a GoConqr? Saiba mais.