Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Issues using swt browser component(Issues using swt browser component)
icon1.gif  Issues using swt browser component [message #1670555] Fri, 13 March 2015 08:39
Christian Hubrich is currently offline Christian HubrichFriend
Messages: 3
Registered: March 2015
Junior Member

currently i am faceing some problems using the swt browser component in combination with a CTabFolder. I whould like to create a tab supported browser shell. Currently my code looks like the following:

package mcss.test;

import org.eclipse.swt.SWT;

public class AgileBrowser extends Shell {

	public CTabFolder tabFolder;

	public static void main(String args[]) {
		try {
			Display display = Display.getDefault();
			AgileBrowser shell = new AgileBrowser(display);;
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
		} catch (Exception e) {

	public AgileBrowser(Display display) {
		super(display, SWT.SHELL_TRIM);
		setLayout(new FillLayout(SWT.HORIZONTAL));

		tabFolder = new CTabFolder(this, SWT.BORDER);

		CTabItem tbtmBrowser = new CTabItem(tabFolder, SWT.NONE);


		Composite composite = new Composite(tabFolder, SWT.NONE);
		composite.setLayout(new FillLayout(SWT.HORIZONTAL));
		Browser browser = new Browser(composite, SWT.NONE);


		CTabItem tbtmNewItem = new CTabItem(tabFolder, SWT.NONE);
		tbtmNewItem.setText("New Item");


	 * Create contents of the shell.
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 300);


	public void addBrowserEvents(Browser pBrowser) {

		pBrowser.addLocationListener(new LocationListener() {
			public void changed(LocationEvent event) {


			public void changing(LocationEvent event) {

		pBrowser.addVisibilityWindowListener(new VisibilityWindowListener() {
			public void hide(WindowEvent e) {

			public void show(WindowEvent e) {

		pBrowser.addCloseWindowListener(new CloseWindowListener() {
			public void close(WindowEvent event) {

		pBrowser.addOpenWindowListener(new OpenWindowListener() {
			public void open(WindowEvent e) {
				final WindowEvent ev = e;
				e.display.asyncExec(new Runnable() {
					public void run() {
						// TODO Auto-generated method stub
						CTabItem tbtmBrowser2 = new CTabItem(tabFolder, SWT.NONE);
						tbtmBrowser2.setText("Agile 9");

						Composite composite = new Composite(tabFolder, SWT.NONE);
						composite.setLayout(new FillLayout(SWT.HORIZONTAL));
						Browser b = new Browser(composite, SWT.NONE);
						ev.browser = b;

	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components


The code works fine for "normal" websites. Now my problem :

-I open an url to a login jsp servlet.
-I can login using my mormal user ans password (everything fine)
-During the login process the jsp opens a new window (also a new session) . Within this window the webapplication should be displayed.
-My browser application opens a new tab, loades the web application, but the hole fomatiing of the web application is corrupt. It seems that the new created browser swt component starts to load the webapp, but not completly. Also all button within the webapplication are not clickable. The browser component seems frozen.

Any Idea?

Previous Topic:Download images in an SWT Mozilla browser
Next Topic:Building JNI libraries
Goto Forum:

Current Time: Sun Jan 17 18:43:18 GMT 2021

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

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

Back to the top