Creation JButton avec iterator.
Bonjour, j'ai une petite question concernant l'iterator.
En fait je ne saisis pas trop comment ça fonctionne car je voudrais créer un bouton selon le nombre d'iteration dans mon fichier xml donc pour afficher je fais ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
List<?> listProfil = racine.getChildren("profil");
Iterator<?> i = listProfil.iterator();
while (i.hasNext()) {
Element courant = (Element) i.next();
System.out.println(courant.getChild("nom").getText());
System.out.println(courant.getChild("type").getText());
System.out.println(courant.getChild("icone").getText());
}
} |
ça fonctionne mais pour créer un bouton à chaque fois je ne sais pas comment récupérer l'index en fait...Merci d'avance.