views:

264

answers:

2

Is there a way to display a Flash or Adobe Reader ActiveX control in a Java AWT frame?

I'm porting a large old J++ application to standard Java and it needs to host a certain ActiveX control on an AWT frame.

Is this possible?

I looked at the JACOB (Java to COM Bridge) project and it doesn't appear to support ActiveX objects that draw on the screen.

A: 

It appears that you will need to purchase a proprietary library in order to able to do this, as Java itself doesn't allow access to COM. Another similar question (about just Flash in Java) can be found here and a couple commercial solutions were listed.

I should note that whatever route you end up taking, you should optimally try to find a library that provides access to an Internet Explorer control, as opposed to just Flash or Adobe Reader. That's because, once you have access to an IE element, you can provide it with a URL (even if it's a local file) of either a .swf or .pdf document, and it will automatically load the correct plugin for each (I used this shortcut once for a personal C++ project in which I needed to load several different ActiveX controls). It appears that the EasyJCom library at the above link does provide such access to an embedded IE control.

Thanks for that. Turns out I've stumbled on the answer myself, and the answer is mixing SWT and AWT, as SWT supports ActiveX controls via OleClientSite.
Judah Himango
+1  A: 

It looks like this can be done by mixing AWT and SWT.

The Eclipse project has a sample snippet that embeds Microsoft Word into an AWT/SWT mixed app.

Judah Himango