Question

is JavaFX capable of loading and embedding OCX Controls? I would like to use the Internet explorer in my Application, because the WebKit browser lacks support for ActiveX. And since I have to rely on third party ActiveX Controls (I know they are evil), I am bound to the IE.

This question is not purely related to "Can I use OCX in Java" because I would like to have some kind of component for JavaFX I would like to use.

Or do I have to rely on libraries posted here:

Use a .OCX Control in Java

Thanks in advance,

Sven

Was it helpful?

Solution

You have to rely on the libraries posted in the link you supplied in your question. Or you need to write your own JNI interface.

If you do access OCX components, you may need to place them in their own window rather than sharing a window created by a JavaFX stage as you may run into issues with the JavaFX renderer conflicting writes on the window portions in which the OCX components are displayed - you would have to try it and see what happens to confirm.

The easier way to do this may be to request that users of your application set their default browser to IE, and then call the JavaFX hostservices.showDocument(uri) api to launch an IE page which embeds the OCX components you need.

Another alternative is to:

  1. Embed your JavaFX application as an applet in a web page.
  2. Also embed your activex controls in the web page.
  3. On display of the web page, check the browser and, if it isn't IE, tell they user that the must be using Internet Explorer.
  4. Have the user accept any miscellaneous security warnings the Browser displays.
  5. Have the user (or perhaps JavaScript) resize the browser window to fullscreen (see IE9 Full Screen Mode or Full Screen Browsers with JavaScript).
  6. Communicate between your active X controls and java app using javascript invoked via calls from the javafx/javascript bridge and control your active X controls via VBScript embedded in the page.

It would probably work, but it is such an ugly Frankenstein solution . . .

If you can convert your media to a format which JavaFX supports and just play it back direct through JavaFX, that would be much preferable, or it may also turn out that due to a deep ActiveX integration requirement that JavaFX is not the best solution to your problem and you could be better off with something like Silverlight.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top