[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Help with SWT Separator widget...Can't get rid of the white line across the shell

Actually found out...Once I set the Url of the browser to http://www.eclipse.org. I can see that the white line is actually the vertical space (default to 5 pixels) of the browser. So, I need to set the shell's vertical spacing to 0. That did the trick! :-)

AL wrote:

Hi,

I've been trying to get rid of the white line that goes across the shell in the below program when adding a separator. I have not luck for the past days. Please advise. Greatly appreciated!

import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;

public class MySeparator {
    public static void main(String [] args) {
        Display display = new Display();
        final Shell shell = new Shell(display, SWT.TOOL);

shell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

shell.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
        GridLayout gridLayout = new GridLayout(1, false);
        gridLayout.marginHeight = -2;
        gridLayout.marginWidth = -2;
        shell.setLayout(gridLayout);

        GridData data = new GridData();
        final Browser browser = new Browser(shell, SWT.NONE);
        data = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
        data.horizontalSpan = 1;
        browser.setLayoutData(data);

// Horizontal separator line
Label separator= new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_SOLID);
data = new GridData(GridData.FILL_HORIZONTAL);
separator.setLayoutData(data);


        // Status field label
        Label statusField= new Label(shell, SWT.NONE);

statusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));


statusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));



Font font= statusField.getFont();
FontData[] fontDatas= font.getFontData();
for (int i= 0; i < fontDatas.length; i++)
{
fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
}
Font statusTextFont = new Font(statusField.getDisplay(), fontDatas);
statusField.setFont(statusTextFont);


        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        statusField.setLayoutData(data);
        statusField.setText("Status text");

// Nothing gets displayed!
browser.setText("<html><body style=\"overflow:auto;\" text=\"#000000\" bgcolor=\"#ffffe1\"><font size=2><b>TEST</b></font></body></html>");


        shell.open();

        // Same if I set url! Nothing gets displayed
        // browser.setUrl("www.eclipse.org");
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}