tags:

views:

115

answers:

2

Hi,

I'm trying to add a Java JFrame into a container inside a C# form. The JFrame I have is implementing a AppletStub aswell, and I've used IKVM to do the interopting, but the problem I get is that the Applet loaded in the AppletStub freezes. But it works perfect fine when its not interopting with C#. This is the only thing I'm doing btw, trying to load that JFrame into my C# form, and pass 2 integer values to the JFrame. Please let me know if there is a simple solution to do this...?

Also, let me know if this will be alot more easier in C++ rather then C#, so I can just do Java -> C++ -> C# ~ Thanks

A: 

Hmm, this is a little odd.

Maybe a lame trick could be to put the applet in as HTML inside a relevant C# control?

Noon Silk
But its not an Applet, I tried making the JFrame into an Applet or atleast a JApplet, but both get permission denied errors when tried to use the AppletStub.
Ah, not an applet. Well. That's something I have no idea about then; sorry.
Noon Silk
A: 

I suspect that you may be having problems with the IKVM/Swing idea of what the UI thread is clashing with the WinForms idea ditto -- code that tried to perform WinForms UI operations on the wrong thread usually end up manifesting as frozen UI. I've not delved into the internals of the IKVM GUI implementation to be able to hazard a work-around (last time I tried UI stuff in IKVM, it was abundantly clear that this was not a priority for that project).

Steve Gilham
So you are saying this is not possible...?
It's software, open source in the case of IKVM, so the definition of "not possible" is a fairly elastic one; but you would probably have to do a bit of delving into IKVM internals to diagnose the problem. It's possible that wrapping every call to a UI component with an appropriate dispatch to its UI thread might be enough, but without looking into the implementation details, I can't be sure.You might be able to do something by holding the JFrame off-screen and just rendering its contents as an image into the WinForm, and then forwarding events on the WinForm back to the JFrame.
Steve Gilham
What I'd try first would be putting a suitable Graphics object I controlled throguh the JFrame's paint method, and rendering that as an image in some neutral format, which could then be piped through to the Form. Whether this would work, I don't know, but it seems the sort of thing that could be experimented with fairly quickly in a stand-alone program.
Steve Gilham
I do not know what you mean completely, but this idea looks promising :) I'll post another question on rendering the JFrame's image to the form.