Bonjour,
J'ai besoin d'associer a un bouton une valeur pour un evenement (le commentaire dans le code).
Or je ne sais pas comment faire, j'utilise le code ci-dessous pour le moment :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private String currentClassCode;
private JPanel classView() {
	String[] tags=professions.getClassTags();
	JPanel icons=new JPanel(new GridLayout(1, tags.length));
	JButton[] bprof=new JButton[tags.length];
	for(int i=0; i<tags.length; i++) {
		bprof[i]=new JButton(new ImageIcon("ressources/images/class/"+tags[i]+".gif"));
		bprof[i].setSize(90, 90);
		currentClassCode=tags[i];
		bprof[i].addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent ae){
				//associer currentClassCode=tags[i];
				list.setViewportView(attributeView(professions.getClassByCode(currentClassCode)));
			}
		});
		icons.add(bprof[i]);
	}
	return icons;
}
Quelqu'un pourrait m'aider s'il vous plait.
Merci d'avance.