Embedding IE in an SWT application

Main.java:

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleControlSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
 
public class EmbedIE {
   OleAutomation automation = null;
   
   public EmbedIE() {
      Display display = new Display();
      Shell shell = new Shell(display);

      FormLayout layout= new FormLayout();
      shell.setLayout(layout);

      OleFrame frame = new OleFrame(shell, SWT.PUSH);
      FormData formData = new FormData();
      formData.top = new FormAttachment(0, 10);
      formData.left = new FormAttachment(0, 100);
      formData.right = new FormAttachment(100, 0);
      formData.bottom = new FormAttachment(100, -10);
      frame.setLayoutData(formData);
      OleControlSite controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer");
      controlSite.doVerb(OLE.OLEIVERB_SHOW);
      automation = new OleAutomation(controlSite);
      int[] rgdispid = automation.getIDsOfNames(new String[]{"GoHome"});
      int dispIdMember = rgdispid[0];
      automation.invoke(dispIdMember);
      
      Composite composite = new Composite(shell, SWT.NONE);
      GridLayout gridLayout = new GridLayout();
      gridLayout.numColumns = 1;
      composite.setLayout(gridLayout);
      Button site1 = new Button(composite, SWT.NONE);
      site1.setText("IE Home");
      Button site2 = new Button(composite, SWT.NONE);
      site2.setText("Synergetic");
      Button site3 = new Button(composite, SWT.NONE);
      site3.setText("Esus.com");
      
      site1.addListener(SWT.Selection, new Listener() {
         public void handleEvent(Event e) {
            goHome();
         }
      });      
      
      site2.addListener(SWT.Selection, new Listener() {
         public void handleEvent(Event e) {
            goUrl("www.synergetic-solutions.be");
         }
      });
      
      site3.addListener(SWT.Selection, new Listener() {
         public void handleEvent(Event e) {
            goUrl("www.esus.com");
         }
      });
      
      
      shell.open();
      
      while (!shell.isDisposed()) {
         if (!display.readAndDispatch()) {
            display.sleep();
         }
      }
      display.dispose();      
   }
   
   public void goHome() {
      int[] rgdispid = automation.getIDsOfNames(new String[]{"GoHome"});
      int dispIdMember = rgdispid[0];
      automation.invoke(dispIdMember);
   }      
   
   public void goUrl(String url) {
      int[] rgdispid = automation.getIDsOfNames(new String[]{"Navigate"});
      int dispIdMember = rgdispid[0];
      Variant[] rgvarg = new Variant[1]; // this is the URL parameter
      rgvarg[0] = new Variant(url);
      Variant pVarResult = automation.invoke(dispIdMember, rgvarg);      
   }
   
   public static void main(String []args) {
      new EmbedIE();
   }
}