Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » readAndDispatch Causing Hang With Browser
readAndDispatch Causing Hang With Browser [message #480322] Sat, 15 August 2009 01:32
Jesse is currently offline JesseFriend
Messages: 3
Registered: July 2009
Junior Member
I have a SWT Browser embedded in an AWT Canvas. The Browser is normally
used for displaying ads. Some of these ads are Flash. Most of the time
readAndDispatch takes under 50-150 ms. For certain Flash ads it
skyrockets to 15000 ms. During this time the GUI hangs. This is causing
major issues with the application.

Is there anything that can be done? Can the readAndDispatch call be



Here is the test case code I am using:

import java.awt.Canvas;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Test1 {
public static void main(String args[]) {
JFrame f = new JFrame();

Canvas canvas = new Canvas();

f.add( canvas );
Display display = new Display();
Shell shell = SWT_AWT.new_Shell(display, canvas);
Browser browser = new Browser(shell, SWT.NONE);
browser.setLayoutData( new GridData(GridData.FILL_BOTH));


browser.setVisible( true );;
while(!shell.isDisposed()) {
before = System.currentTimeMillis();

boolean more = display.readAndDispatch();

after = System.currentTimeMillis();

if ( after - before != 0 )
System.out.println( after - before );

Previous Topic:Preventing a shell from closing
Next Topic:Wrap Label
Goto Forum:

Current Time: Sat Feb 22 07:53:52 GMT 2020

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

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

Back to the top