I try to obtain name of List of JCheckBox but appear a string null. This is my code;
JCheckBox mesi [] = {gennaioCheck, febbraioCheck, marzoCheck, aprileCheck, maggioCheck, giugnoCheck,
luglioCheck, agostoCheck, settembreCheck, ottobreCheck, novembreCheck, dicembreCheck};
for (JCheckBox m : mesi){
if (m.isSelected()){
System.out.println(m.getName());
}
您可能打算使用getText()
。
System.out.println(m.getText());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.