Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Help with SWT Separator widget...Can't get rid of the white line across the shell
Help with SWT Separator widget...Can't get rid of the white line across the shell [message #456728] Tue, 07 June 2005 22:14 Go to next message
Alex Le is currently offline Alex LeFriend
Messages: 649
Registered: July 2009
Senior Member
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_BA CKGROUND));

shell.setForeground(display.getSystemColor(SWT.COLOR_INFO_FO REGROUND));
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_W IDGET_DARK_SHADOW));

statusField.setBackground(display.getSystemColor(SWT.COLOR_I NFO_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();
}
}
Re: Help with SWT Separator widget...Can't get rid of the white line across the shell [message #456729 is a reply to message #456728] Tue, 07 June 2005 22:33 Go to previous message
Alex Le is currently offline Alex LeFriend
Messages: 649
Registered: July 2009
Senior Member
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_BA CKGROUND));
>
> shell.setForeground(display.getSystemColor(SWT.COLOR_INFO_FO REGROUND));
> 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_W IDGET_DARK_SHADOW));
>
>
> statusField.setBackground(display.getSystemColor(SWT.COLOR_I NFO_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();
> }
> }
>
Previous Topic:Convert from SWT Image to Swing ImageIcon
Next Topic:How to use TableTreeEditor??
Goto Forum:
  


Current Time: Fri Apr 26 23:06:53 GMT 2024

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

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

Back to the top