简体   繁体   中英

Listener for Multiple checkboxes in multiple PanCards in Java (NetBeans)

I'm trying to make a Quizz, and I've created multiple PanCards(15), each having a question and 4 answers (radio buttons or check boxes or text fields) and I'm trying to export what the user clicks/introduces in a *.txt file. Is there any method to do it more quick? Or I should create an eventListener for each question and if the checkboxes are selected, I'll write them separately. I can't figure out how am I supposed to know how many checkboxes will going to be selected, since each pan has 4 checkboxes from which the user can select from 0 to 4 answers and the radio buttons are grouped as buttonGroup(1,2,7,8,13)

So, I can't do something like this: for (int i=0; i

Any ideas?

I don't think you need eventlisteners for every element. The way I see it you don't want the info about the checkboxes/text fields when the user just filled them in. You should just check the status of your checkboxes and textfields when the user is done with the specific quiz question, which is when for example the user presses a button labeled "Next question".

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM