[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Get rid of the margins on the left and right of the opened browser

Just use CSS and "margin:0px" inside the body Tag

<body style="margin:0;">

Ben

> Hi,
>
> Sorry for another posting...I have a simple program below that opens
> the browser.  I've managed to eliminated the margin width and height
> with a -1 set to the shell's marginWidth and marginHeight.  But on the
> left and right sides of the browser, I still see the spacing.  How do
> I get rid of that?  See attached image...THANKS!
>
> /* My program */
> import org.eclipse.swt.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.widgets.*;
> import org.eclipse.swt.browser.*;
>
> public class MySnippet128
> {
>     public static void main(String [] args)
>     {
>         Display display = new Display();
>         final Shell shell = new Shell(display, SWT.TOOL);
>         GridLayout gridLayout = new GridLayout();
>         gridLayout.marginHeight = -1;
>         gridLayout.marginHeight = -1;
>         gridLayout.numColumns = 1;
>         shell.setLayout(gridLayout);
>
>         GridData data = new GridData();
>         final Browser browser = new Browser(shell, SWT.TOOL);
>         data = new GridData(GridData.FILL_HORIZONTAL |
> GridData.FILL_VERTICAL);
>         data.horizontalSpan = 1;
>         browser.setLayoutData(data);
>
>         shell.open();
>         browser.setText("<html><body style=\"overflow:auto;\"
> text=\"#000000\" bgcolor=\"#ffffe1\"><font
> size=2><b>TEST</b></font></body></html>");
>         // browser.setUrl("http://eclipse.org";);
>
>         while (!shell.isDisposed())
>            {
>             if (!display.readAndDispatch())
>                 display.sleep();
>         }
>         display.dispose();
>     }
> }