fdBrowser.right = new FormAttachment( 100, 0 ); fdBrowser.bottom = new FormAttachment( 100, -buttonHeight ); wBrowser.setLayoutData( fdBrowser );
fdMessage.top = new FormAttachment( 0, 0 ); fdMessage.bottom = new FormAttachment( 0, 100 ); message.setLayoutData( fdMessage );
/** * maximizeBrowser * * @param browser * the browser object to maximize. We try to take up as much of the Spoon window as possible. */ private static void maximizeExpandedContent( Browser browser ) { SashForm sash = (SashForm) spoonInstance().getDesignParent(); int[] weights = sash.getWeights(); int[] savedSashWeights = new int[weights.length]; System.arraycopy( weights, 0, savedSashWeights, 0, weights.length ); spoonInstance().getTabSet().getSelected().setSashWeights( savedSashWeights ); weights[0] = 0; weights[1] = 1000; sash.setWeights( weights ); FormData formData = new FormData(); formData.top = new FormAttachment( 0, 0 ); formData.left = new FormAttachment( 0, 0 ); formData.bottom = new FormAttachment( 100, 0 ); formData.right = new FormAttachment( 100, 0 ); browser.setLayoutData( formData ); browser.getParent().layout( true ); browser.getParent().redraw(); } }
browser.setLayoutData( fdBrowser );
browserFormData.left = new FormAttachment( 0, 5 ); browserFormData.right = new FormAttachment( 100, -5 ); browser.setLayoutData( browserFormData );
fdBrowser.right = new FormAttachment( 100, 0 ); fdBrowser.left = new FormAttachment( 0, 0 ); wBrowser.setLayoutData( fdBrowser ); wBrowser.setUrl( url );
Browser browser = getBrowser(); if (browser != null) { browser.setLayoutData(gridData); browser.setText("<html><body></body></html>");
@Override public void setLayoutData( Object data ) { browser.setLayoutData( data ); }
Bundle bundle = Platform.getBundle("org.mozilla.xulrunner"); //$NON-NLS-1$ if (bundle != null) { URL resourceUrl = bundle.getResource("xulrunner"); //$NON-NLS-1$ if (resourceUrl != null) { try { URL fileUrl = FileLocator.toFileURL(resourceUrl); File file = new File(fileUrl.toURI()); System.setProperty("org.eclipse.swt.browser.DefaultType", "mozilla"); System.setProperty( "org.eclipse.swt.browser.XULRunnerPath", file.getAbsolutePath()); //$NON-NLS-1$ } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } } } else { System.err.println("Could not find XULrunner bundle"); } Browser webBrowser = new Browser(parent, SWT.MOZILLA); GridData grid = new GridData(GridData.FILL_BOTH); webBrowser.setLayoutData(grid); // Prepending "file://" prevents the "<driveletter> is not a registered protocol" error String graphUrl = "file://C:/Users/you/yourGraph.html" webBrowser.setUrl(graphUrl);
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); gridData.horizontalSpan = 3; swtBrowser.setLayoutData(gridData); activated = true; } catch (SWTException ex) {
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); gridData.horizontalSpan = 3; swtBrowser.setLayoutData(gridData); activated = true; } catch (SWTException ex) {
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); browser.addLocationListener(new LocationListener() { public void changing(LocationEvent event) {
toolkit.adapt(browser); toolkit.paintBordersFor(browser); browser.setLayoutData(browserGD);
public static void main( String[] args ) { String html = "<html><head></head><body>"; for( int i = 0; i < 100; i++ ) { html += "<h2 id=\"id" + i + "\">This is header " + i + "</h2>"; } html += "</body></html>"; Display display = new Display(); Shell shell = new Shell( display ); shell.setLayout( new GridLayout( 1, false ) ); Button button = new Button( shell, SWT.PUSH ); button.setText( "Focus header 17" ); Browser browser = new Browser( shell, SWT.BORDER ); browser.setText( html ); browser.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); button.addListener( SWT.Selection, new Listener() { @Override public void handleEvent( Event event ) { if( !browser.execute( "document.getElementById( 'id17' ).focus();" ) ) { throw new RuntimeException( "Failed to execute Javascript" ); } } } ); shell.open(); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) display.sleep(); } display.dispose(); }
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@Override public void run() { final Browser browser = new Browser(parent, SWT.NONE); browser.setLayoutData(new GridData(GridData.FILL_BOTH)); browser.setText(html); browser.addLocationListener(JavaElementLinks
initializeShell(shell); Browser browser = new Browser(shell, SWT.NONE); browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));