 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
aspa Guest
|
Posted: Mon Apr 18, 2005 7:44 pm Post subject: Occasional exceptions in event dispatching |
|
|
hi
i'm having some problems with a Java applet i've written using Java2
v1.3. the applet is a JApplet and uses JTree component to view a tree
hierarchy for the user. occasionally, i see the below error message on
Java console (Mac OS X v10.3.9, Safari, Java 1.4.2_05-141.4). this error
seems to be related to switching focus between the browser and other
applications.
any clue on what might be causing this?
apple.awt.EventQueueExceptionHandler Caught Throwable :
java.lang.IllegalArgumentException: null source
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:34)
at java.awt.AWTEvent.<init>(AWTEvent.java:226)
at java.awt.event.ComponentEvent.<init>(ComponentEvent.java:94)
at java.awt.event.WindowEvent.<init>(WindowEvent.java:174)
at java.awt.event.WindowEvent.<init>(WindowEvent.java:211)
at
java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:576)
at java.awt.Component.dispatchEventImpl(Component.java:3572)
at java.awt.Container.dispatchEventImpl(Container.java:1671)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3543)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.SentEvent.dispatch(SentEvent.java:50)
at
java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:145)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
br. aspa
|
|
| Back to top |
|
 |
Nigel Wade Guest
|
Posted: Tue Apr 19, 2005 2:15 pm Post subject: Re: Occasional exceptions in event dispatching |
|
|
aspa wrote:
| Quote: | hi
i'm having some problems with a Java applet i've written using Java2
v1.3. the applet is a JApplet and uses JTree component to view a tree
hierarchy for the user. occasionally, i see the below error message on
Java console (Mac OS X v10.3.9, Safari, Java 1.4.2_05-141.4). this error
seems to be related to switching focus between the browser and other
applications.
any clue on what might be causing this?
apple.awt.EventQueueExceptionHandler Caught Throwable :
java.lang.IllegalArgumentException: null source
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:34)
at java.awt.AWTEvent.<init>(AWTEvent.java:226)
at java.awt.event.ComponentEvent.<init>(ComponentEvent.java:94)
at java.awt.event.WindowEvent.<init>(WindowEvent.java:174)
at java.awt.event.WindowEvent.<init>(WindowEvent.java:211)
at
java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:576)
at java.awt.Component.dispatchEventImpl(Component.java:3572)
at java.awt.Container.dispatchEventImpl(Container.java:1671)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3543)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.SentEvent.dispatch(SentEvent.java:50)
at
java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:145)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
br. aspa
|
Are you following Sun's guidelines and creating the GUI in the event
dispatching thread:
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html#EDT
If you create the GUI in the main thread, and somehow realize a component in
that thread which you then go on to modify it's possible that you will be
attempting to modify it before it's been fully realized by the EDT. This
can have very unpredictable results, including inexplicable null pointer
exceptions. It creates a race condition; sometimes it will work, sometimes
it will fail.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : [email]nmw (AT) ion (DOT) le.ac.uk[/email]
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
|
|
| Back to top |
|
 |
aspa Guest
|
Posted: Sat Apr 23, 2005 6:12 pm Post subject: Re: Occasional exceptions in event dispatching |
|
|
Nigel Wade wrote:
| Quote: | aspa wrote:
Are you following Sun's guidelines and creating the GUI in the event
dispatching thread:
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html#EDT
If you create the GUI in the main thread, and somehow realize a component in
that thread which you then go on to modify it's possible that you will be
attempting to modify it before it's been fully realized by the EDT. This
can have very unpredictable results, including inexplicable null pointer
exceptions. It creates a race condition; sometimes it will work, sometimes
it will fail.
|
thanks for the tip. i re-read the guidelines. i was modifying the model
in edt but the gui was being created in main thread. now, i populate the
model in main but after that create the gui in edt. let's see if this helps.
br. aspa
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|