Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » swt awt browser
swt awt browser [message #668405] Thu, 05 May 2011 15:06 Go to next message
logos paragon is currently offline logos paragonFriend
Messages: 1
Registered: May 2011
Junior Member
Hi

I'm trying to extend a swing application with an embedded browser widget. So far i've tried SWT_AWT bridge to embed the swt browser widget into a swing panel but no success...
It simply doesn't show up.

Does anyone know how to do this properly?

Here is how i tried it.

java.awt.Canvas canvas = new java.awt.Canvas();

browserPanel.add(canvas);
canvas.setName("canvas");
browserPanel.show();

Display display = new Display();
Shell swtShell = SWT_AWT.new_Shell(display,canvas);

final org.eclipse.swt.browser.Browser browser = new org.eclipse.swt.browser.Browser(swtShell, SWT.NONE);

swtShell.open();


Thanks

[Updated on: Thu, 05 May 2011 15:06]

Report message to a moderator

Re: swt awt browser [message #668509 is a reply to message #668405] Thu, 05 May 2011 22:15 Go to previous messageGo to next message
Chris A is currently offline Chris AFriend
Messages: 2
Registered: May 2011
Junior Member
Try initializing it from org.eclipse.swt.widgets.Display. It also needs to be started on the main thread, as I have had problems spawning threads and getting it to run.

Example:

private Shell shell;
private Canvas canvas;
private Browser browser;
private Display display = new Display();

display.syncExec(new Runnable() {
			@Override
			public void run() {
				shell = SWT_AWT.new_Shell(display, canvas);		
				browser = new Browser(shell, SWT.NONE);	
				swtBrowser.setUrl(url);
				shell.open();	
			}
		});
Re: swt awt browser [message #669362 is a reply to message #668405] Tue, 10 May 2011 05:36 Go to previous message
Lakshmi ShanmugamFriend
Messages: 276
Registered: July 2009
Location: India
Senior Member
Here is an example snippet which does this --> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet337 .java

Lakshmi P Shanmugam
Previous Topic:Problem with Gridlayout
Next Topic:Java setFullScreenWindow and Browser woes
Goto Forum:
  


Current Time: Fri Nov 27 00:45:08 GMT 2020

Powered by FUDForum. Page generated in 0.04490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top