bon j'avais pour mes menus  :
      public void actionPerformed(ActionEvent ae) {
        monAction();
      }

maintenant j'ai :
      public void actionPerformed(ActionEvent ae) {
        SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          monAction();
          }
       });
      }

Pas de changements: au bout d'un moment je retrouve l'exception bien que je
fasse toujours la m�me chose...

Ca doit �tre moins simple... ;-))

Exception occurred during event dispatching:
java.lang.NullPointerException: null pData
        at sun.awt.windows.WInputMethod.handleNativeIMEEvent(Native Method)
        at sun.awt.windows.WInputMethod.dispatchEvent(WInputMethod.java:275)
        at sun.awt.im.InputContext.dispatchEvent(InputContext.java:202)
        at
sun.awt.im.InputMethodContext.dispatchEvent(InputMethodContext.java:177)
        at java.awt.Component.dispatchEventImpl(Component.java:2529)
        at java.awt.Container.dispatchEventImpl(Container.java:1213)
        at java.awt.Component.dispatchEvent(Component.java:2499)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
        at
java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:2318)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2189)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
        at java.awt.Container.dispatchEventImpl(Container.java:1200)
        at java.awt.Window.dispatchEventImpl(Window.java:912)
        at java.awt.Component.dispatchEvent(Component.java:2499)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
        at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)



----- Original Message -----
From: "Herve AGNOUX" <[EMAIL PROTECTED]>
To: "Guillaume Helle" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, April 03, 2002 4:57 PM
Subject: Re: JMenu dynamique et exceptions...


Le 3 Apr 2002 Guillaume Helle a �crit :

> Heu non...
> T'as plus d'infos???
>

Arg ! GRAVE erreur ! SAUF si tu n'as qu'un seul thread. Ce serait un
coup de veine suspect. Sinon, tu dois mettre � jour ton environnement
swing dans ce que l'on appelle le "AWT event dispatching thread", ou
bien "Swing event dispatching thread", selon... je sais pas quoi.

Suis les pistes � propos de SwingUtilities.invokeLater,
SwingUtilities.invokeAndWait, en t'aidant du tutorial de sun. C'est
une merveille de construction officiellement super-orient� objet dans
le discours, piteusement magouilleur dans les faits. Concentre-toi
sur les faits, ils sont passionnants.

--
Sur le Web, tout de suite.
Herve AGNOUX - diaam informatique
http://www.diaam-informatique.com

Répondre à