Bonjour,

J'ai créé sous Eclipse une classe visuelle, qui contient divers boutons, combo..etc

j'ai codé de sorte que lorsque j'appuie sur un bouton, le texte contenu dans une de mes combo, est envoyé en paramètre à une autre méthode de ma classe. Bref rien de bien compliqué !

voici le code lors de l'appuie sur le bouton:

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
private JButton getJButton_Validation() {
 
	if (jButton_Validation == null) {
		jButton_Validation = new JButton();
		jButton_Validation.setBounds(new Rectangle(330, 195, 240, 53));
		jButton_Validation.setText("OK");
 
 
		jButton_Validation.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent e) {
 
 
				System.out.println("Remplissage du JList()"); // TODO Auto-generated Event stub actionPerformed()
 
 
				generateFichier(getJComboBox_TrueDir().getSelectedItem().toString());  //on envoie à la méthode, le contenu de ma combo
				DefaultMutableTreeNode racine = new DefaultMutableTreeNode("Sélection",true);  /*  on définit notre premier noeud   */
 
			}
		});
	}
	return jButton_Validation;
}

L'appli se lance correctement, mais par contre dans la console, j'ai des erreurs du type :

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at PMain.IhmPrinci$4.actionPerformed(IhmPrinci.java:339)
Remplissage du JList()
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Pour info, l'erreur ligne 339, correspond à cette ligne la :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
generateFichier(getJComboBox_TrueDir().getSelectedItem().toString());  //on envoie à la méthode, le contenu de ma combo

Merci par avance