Exception lors d'un clic sur une feuille d'un arbre
Bonjour j´ai un Tree qui fonctionne relativement bien . J´ai implemente un Tree listener qui reagit lors de la selection d´un node en affichant des informations sur ce node dans un cadre a droite du Tree . Voici le code de cette selection :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
if(getLastSelectedPathComponent()==null) return;
MutableTreeNode mtn= (MutableTreeNode) getLastSelectedPathComponent();
if (mtn == null) return;
IMEntitesNodeTree dp=(IMEntitesNodeTree)mtn;
if (dp.isLeaf())
dp.retrieve(false);
parent.savePanel();
parent.updatePanel(dp);
}
}); |
Bizarrement, lorsque je selectionne une feuille . A la fin de ce Listener , cela envoie une exception :
Citation:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTreeUI.isToggleEvent(BasicTreeUI.java:2232)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2297)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelectionImpl(BasicTreeUI.java:3509)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3484)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3465)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
at java.awt.Component.processMouseEvent(Component.java:5514)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3889)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Apparemment , le probleme vient du ToggleEvent .Je ne vois pas pourquoi il y a un probleme lorsqu´il compte le nombre de clics ...
Je vous remercie d´avance !!