[906] in java-interest

home help back first fref pref prev next nref lref last post

threads and native windows

daemon@ATHENA.MIT.EDU (Andrew Wason)
Mon Aug 14 23:14:12 1995

To: java-interest@java.sun.com
Date: Mon, 14 Aug 95 19:36:40 -0400
From: Andrew Wason <aw@bae.bellcore.com>

I have a Java object with a native method that creates a native
Windows NT window (HWND).  I wrote an Applet that creates an
instance of this object (and thus creates an NT HWND).

Hotjava runs my Applet in a separate native NT thread, and so my
HWND is owned by this thread since that's where it gets created.
I verified this by using NT spyxx.exe to compare the NT thread ID
of my HWND and the thread ID of the browsers main window.  Since
the HWND was created by this Applet thread, when the native
thread exits (right after calling my Applet.start() method), the
HWND is automatically destroyed.  So as my Applet initializes, my
native window pops up briefly and then is destroyed as the Applet
initialization thread exits.

I don't have this problem when creating using the AWT to create
native windows in an Applet.  Even though my Applet.init() is
running in a separate thread, if it creates a new Frame in that
thread, the Frame is owned by the same native NT thread as the
rest of the browsers windows and so it hangs around after the
Applet thread exits.

How does the AWT get its native windows to be owned by a
different thread than the one they were created in?


Thanks,
Andrew


_______________________________________________________________________________

Andrew Wason                                       Bell Communications Research
aw@bae.bellcore.com                                Piscataway, NJ
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post