mardi 30 mai 2017

How to create JCheckBox for elements of an HashMap

I have an HashMap that fills in by a function in this mode:

private static Map<String, String> film = new HashMap<>();

   public static void init() {
   film.put(getIDFilm(), getTitle());
  }

Then each element of this Map will be a CheckBox. For example if the Map has 6 elements, it must create 6 checkboxes and it's important that I have the access to each single checkbox later, so I can specify for example:

if checkbox2 is selected, do this.

So is there any way to make these checkboxes dynamically according to the HashMap's size?




Aucun commentaire:

Enregistrer un commentaire