Bonjour,
ci dessous mon code ( coupé ), j'ai donc 5 setActionCommand, dont les conditions sont configurées ci dessous.


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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
public void actionPerformed(ActionEvent aActionEvent) {
 
      String action = aActionEvent.getActionCommand();
 
		if(action.equals("Configurer")) // BOUTON CONFIGURER ( menu ) OUVRE LE JFC 
		{
				if(this.chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
			{
				this.textChemin.setText(this.chooser.getSelectedFile().getAbsolutePath());
 
 
 
				JOptionPane pane = new JOptionPane(); 
				int option = JOptionPane.showConfirmDialog(null, "Voulez vous vraiment sauvegarder l'emplacement ? ", "INFORMATION", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
				pane.show();
				if (option == JOptionPane.OK_OPTION)
 
				{
 
 
					System.out.println("sauvegarder"); // DEMANDE DE SAUVEGARDE DE L'EMPLACEMENT
					//Creation du fichier XML de CONFIG 
					{
						  // CREATION DU FICHIER XML ICI
						System.out.println("Création du fichier XML et sauvegarde de l'emplacement de l'executable à l'interieur");
 
						XMLEncoder encoder = null;
						try {
							encoder = new XMLEncoder(
												new BufferedOutputStream(
													 new FileOutputStream("config.xml")));;
							encoder.writeObject(textChemin);	 // STOCKAGE DE L'EMPLACEMENT DANS LE FICHIER XML
 
						} catch (FileNotFoundException e1) {
								e1.printStackTrace(); 
						}
						finally {
							encoder.close();
						}
					}
				}
				else {
					System.out.println("ne pas sauvegarder");
 
				}
			}
 
		}
 
 
 
		if(action.equals("Connexion")) // BOUTON CONNEXION LANCEMENT DE L'APPLI CHOISI PAR L'UTILISATEUR + Injection de L'URL
		{
			try
			{
				Runtime.getRuntime().exec(new String[] {this.textChemin.getText(), "http://pendora.fr.nf:8000/listen.pls" }) ;
				// test avec fichier audio "C:\\Users\\pendoRa\\Music\\son\\LIFE.mp3"
			}											
			catch (IOException aIOException)
			{
				JOptionPane.showMessageDialog(this, aIOException.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
			}
 
		}
		if(action.equals("boutonOK")) // IDEM QU'AU DESSU
		{
			try
			{
				Runtime.getRuntime().exec(new String[] {this.textChemin.getText(), "http://pendora.fr.nf:8000/listen.pls" }) ;
				// test avec fichier audio "C:\\Users\\pendoRa\\Music\\son\\LIFE.mp3"
			}											
			catch (IOException aIOException)
			{
				JOptionPane.showMessageDialog(this, aIOException.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
			}
		}
		if(action.equals("XML")); // BOUTON SAUVEGARDER CONFIGURATION ACTUELLE
		{
			  // CREATION DU FICHIER XML ICI
			System.out.println("Création du fichier XML et sauvegarde de l'emplacement de l'executable à l'interieur");
 
			XMLEncoder encoder = null;
			try {
				encoder = new XMLEncoder(
									new BufferedOutputStream(
										 new FileOutputStream("config.xml")));;
				encoder.writeObject(textChemin);
 
 
			} catch (FileNotFoundException e1) {
					e1.printStackTrace(); 
			}
			finally {
				encoder.close();
			}
		}
                if(action.equals("Verif"));
		{
			JOptionPane pane2 = new JOptionPane(); 
				JOptionPane.showMessageDialog(null, "Le chemin d'accès au lecteur multimedia est le suivant :  "+this.textChemin.getText() , "INFORMATION", JOptionPane.INFORMATION_MESSAGE);
				pane2.show();
		}
}
Ma question est : pourquoi la condition "Verif" est exécuté lorsque j'appuie sur le boutonOK ou Configurer par exemple ? Alors que je voudrais seulement l'éxecuter au moment ou la condition se vérifie ( appuis sur le bouton Verif)

Merci