I have a long List of Checkboxes (about 150) on a JPanel on a scrollPane, the user can check if needed. At the end of this Process there is a JButton, which should take all the marked Checkboxes and put their description on a different JPanel. I am pretty new to Java and can't figure out, how to do this without creating an itemListener for every Checkbox, which just seems very unpractical. I've read a lot of threads about putting the Checkboxes into an ArrayList and checking the elements, but I still don't understand how to do this. My Current Code looks something like this:
JCheckBox checkbx511 = new JCheckBox("This is the text I need");
chckbx511.setToolTipText("<html>This would be a nice bonus</html>");
Anybody know an easy way to get all the selected Elements on a new List?
Aucun commentaire:
Enregistrer un commentaire