Bonjour,
Je fais actuellement une application en MVC mais j'ai quelques problèmes :
Pour faire simple je ne crée qu'une JFrame contenant un JPanel de titre qui ne bouge pas et un JPanel qui est centré et qui est modifié (je mets d'autre Panel héritant de JPanel à sa place au long de l'application).
Mon interface Listener s'appelle I5Listener et tous mes panel implémentent cette interface.
J'ai 2 panels qui n'utilisent pas du tout le modèle car ils sont juste reliés au contrôleur.
J'ai un troisième panel qui lui est lié au modèle car contient une liste déroulante (JComboBox) qui se remplit en fonction des nom de ma Base de donnée.
Le problème est le suivant :
lorsque je fais :
Il me dit que j'ai un JavaNullPointerException sur mon EventListenerList et je ne comprends pas pourquoi auriez vous une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 //creation du nouveau panel JPanelVueI5CopyLib pan= new JPanelVueI5CopyLib(this, model); changePanel(pan); //ajout de l'ecouteur correspondant a mon panel model.addI5Listener(pan); //C'est ici que j'ai l'erreur
D'avance merci
Pavel
EDIT : J'obtiens ceci dans ma console
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 Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at model.I5Model.addI5Listener(I5Model.java:46) at controleur.I5Controleur.connection(I5Controleur.java:95) at vues.JPanelVueI5CopyId$BoutonListener.actionPerformed(JPanelVueI5CopyId.java:144) 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.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
Partager