The Artima Developer Community
Sponsored Link

Java Buzz Forum
IE on SWT

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Sergio Umlauf

Posts: 20
Nickname: umlauf
Registered: Jul, 2003

Sergio Umlauf is a Java developer
IE on SWT Posted: Jul 6, 2003 1:40 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Sergio Umlauf.
Original Post: IE on SWT
Feed Title: Four-Calendar Cafe
Feed URL: http://sedoparking.com/search/registrar.php?domain=®istrar=sedopark
Feed Description: Java
Latest Java Buzz Posts
Latest Java Buzz Posts by Sergio Umlauf
Latest Posts From Four-Calendar Cafe

Advertisement
After searching the internet looking for an example on how to embed IE on SWT, I found some interesting things and finally got what I was looking for. Embedding IE on SWT is done through OLE automation. The code below shows how you can achieve that:

// Every control must have an associated OleFrame:
OleFrame webFrame = new OleFrame(sash_form, SWT.CENTER);
try {
	// Create an Automation object for access to extended capabilities
	OleControlSite webControlSite = new OleControlSite(webFrame, SWT.CENTER,"Shell.Explorer");
	oleAutomation = new OleAutomation(webControlSite);
	webControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
	int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Navigate", "URL"});
	int dispIdMember = rgdispid[0];
	Variant[] rgvarg = new Variant[1];
	rgvarg[0] = new Variant("http://www.freeroller.net/page/umlauf");
	int[] rgdispidNamedArgs = new int[1];
	rgdispidNamedArgs[0] = rgdispid[1]; // identifier of argument
	Variant pVarResult = oleAutomation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
} 
catch (SWTException ex) {
	ex.printStackTrace();
	return;
}

Kwel. After that, I started playing with layouts. I had a lot of fun doing that, specially when I discovered SashForm, a special form that automatically adds a splitter (or sash) between his childs. Easy even for a beginner like me :)

SashForm h_sash = new SashForm(shell, SWT.HORIZONTAL | SWT.NULL);
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
h_sash.setLayoutData(gridData);
// Add two widgets here
h_sash.setWeights(new int[] {20,80});

The layout is pretty much defined and my todo list now is:
  • Find a way to resize the Composite that accomodates two or more coolbars when one of then is moved below another;
  • Learn how to change the cursor to hourglass when a page is loading in the browser and how to add a listener to the OLE control to capture the IE messages;
  • Start to studying Informa

Here are some links that might be useful for those who are starting to code with SWT:

Understanding Layouts in SWT
Basic SWT Widgets
SWT Code Snippets
Eclipse Wiki

Read: IE on SWT

Topic: "Is the Semantic Web Hype?": Previous Topic   Next Topic Topic: RMS Options

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use