[Language] Instanciation et utilisation de classes en Java
Bonjour,
j'espere tout d'abord avoir respecté la charte d'utilisation de ce forum .
en ce qui concerne mon pb, je vais essayer d'etre explicite !
mon application est constituée d'une classe
Code:
Ihm01 extends JFrame
d'une deuxieme classe
Citation:
Ihm02 extends JPanel
et dans laquelle se trouve un JtextArea
d'une troisieme classe
Code:
Ihm04 extends JScrollPane
qui comporte un Jtree
la classe Ihm01 instancie les autres classes
Code:
1 2
| this.add(new Ihm02(), BorderLayout.WEST);
this.add(new Ihm04(), BorderLayout.CENTER); |
Mais je ne sais pas acceder a ll'objet ihm02 instancié par la classe Ihm01 a partir de la classe Ihm04
car mon application se doit d' ecrire dans l'objet ihm02 a partir du JTree
Y a t'il deja une erreur de raisonnement ou de conception ?
je ne sais pas si je suis assez clair ?
n'hesitez pas a me poser des questions pour eclaircissement !
voici le msg d'erreur que je recois
Code:
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
| Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at ihms.Ihm04$1.valueChanged(Ihm04.java:139)
at javax.swing.JTree.fireValueChanged(JTree.java:2399)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:2770)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:629)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1078)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:287)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:170)
at javax.swing.JTree.setSelectionPath(JTree.java:1174)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2246)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3432)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3393)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
at java.awt.Component.processMouseEvent(Component.java:5485)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
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:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
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) |
d'avance merci
Cordialement
Olivier