Embedding Internet Explorer in a Java Frame
This example embeds Internet Explorer inside a JFrame, navigates to an HTML document, and reads/displays the tags in the document to the command prompt. To run this example you will need the Java proxies generated from the mshtml type library, as well as the main Internet Explorer typelibrary (shdocvw.dll).
We assume that you are familiar with Java -- no COM knowledge should be required. You may wish to run through some of the more detailed step-by-step examples in the J-Integra documentation (such as the Excel example) prior to trying this example. We assume you have already downloaded and installed the J-Integra SDK.
1. Configure your Environment
2. Download the Java proxies
3. Run the Example
Step 1: Configure your Environment
Create a new folder to where the HTMLDocumentParser.java source file will be downloaded. We assume that you have already configured your DCOM settings and environment variables such as Path and Classpath.
Step 2: Download the Java proxies
We have already generated the Java proxies needed for this example (they can be downloaded below). The two files you need to download are mshtml.zip and shdocvw.zip. Please unzip these files in the same directory as where you saved HTMLDocumentParser.java.
Because this example embeds WebBrowser ActiveX Control in a Java frame, the Java proxies of shdocvw.dll are generated with com2java option Generate Java AWT classes turned on. If your Java client does not embed the WebBrowser ActiveX Control and only accesses the InternetExplorer object, you must turn off the option Generate Java AWT classes, regenerate the Java proxies for shdocvw.dll, and use the InternetExplorer object instead of the WebBrowser object in your Java client. Please use this example instead.
Step 3: Run the Example
Remember to include the \jre\bin directory in your PATH environment variable:
Make sure your CLASSPATH includes jintegra.jar, and then update and compile HTMLDocumentParser.java. If you get compilation errors then either your CLASSPATH is incorrect or your proxies do not have the right package names. After compiling the example, enter the following at the command prompt. The URL can be the address of any website.
java -DJINTEGRA_COINIT_VALUE=2 HTMLDocumentParser http://j-integra.intrinsyc.com
Due the nature of the WebBrowser ActiveX control (shdocvw.dll), the WebBrowser object ignores certain properties including AddressBar, MenuBar, ToolBar, etc. Therefore, if you use these calls (setAddressBar, setMenuBar, setToolBar, etc) with a WebBrowser control it will ignore these calls (but return no error).
MSDN Reference: http://msdn.microsoft.com/en-us/library/aa752043(VS.85).aspx
You will need to implement these controls and buttons yourself. Possible solutions are:
1. Implement them in a Java GUI, such as Swing.
2. Implement them in a VB ActiveX control, then generate Java proxies for this control using com2java.