> "M.Ranganathan" wrote:
> > Hello!
> > I am toying with the idea of imbedding java apps in a tk canvas. (The
> > idea being thattcl/tk is the integration framework and the components
> > are java.) Does anybody know if this can be done ? (and has anbody done
> > it?)
> > Thanks.
> > Ranga.
> Combining Tk widgets and Java widgets is not really supported by
> One workaround I have used is to create a Java window over an existing
> window without a border. This worked for the application I was writing
> because the Java window was only needed for a short time (I used a
> java Frame object to play an MPEG video clip over an existing Tk window
> using the Java Media Framework and my own Tcl-JMF package).
> I hope that helps
> mo dejong
> dejong at cs.umn.edu
I dont really want to combine java and tcl widgets. The question I have is
really more of a java question than a tcl question. I was wondering if I can
supply a top level window (other than the root window) to a java gui
application and have it use that window as its top level window. In that
case, one may effectively imbed java applications in a tcl canvas (just as
one can do with tk applications today - you can supply wish a top-level
window id. ).
This question seem to come up a lot. Lots of people seem to want to
do it and they keep asking "is it possible to ...". Sure anything is
possible. I think it would really help if someone went out and did it.
You can write code in Java that will find the native X window id and
then you could pass that to Tk. Of course, that will not work on Windows
boxes and it will tie the code to a JVM impl but life is like that.
Are you interested in trying that out and telling us how it went?
I would be willing to help all I could but I have no pressing need for
this feature so I am not going to code it.
Have a look in the peer packages, there's classes called MEmbeddedFrame and
WEmbeddedFrame. You'll note the constructor takes a 32 bit integer. On Unix this
an X11 WINDOW, on Win32 this is a HWIN. That should be enough to get the Java app
to appear inside a Tk frame.
dejong at cs.umn.edu
I just tried exactly this kind of thing with a GVIM toplevel window
under win95. I used a frame with -container 1 and then used a win api
call to transfer ownership of the window from the desktop to the frame.
There was a mismatch between the manager protocols though so I got root
window behaviour for GVIM, but inside my frame; a bit like MDI, but