JFace ApplicationWindow white line at top of Window

I've created the most basic JFace ApplicationWindow I can think of and I get this 1 pixel white border at the top of the screen:

alt text

And the code to create it:

 

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.SWT;

public class TestWindow extends ApplicationWindow {
    public TestWindow() {
        super(null);
    }

    protected Control createContents(Composite parent) {
        this.getShell().setText("Test Window");

        parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));
        return parent;
    }
}

 

 

 

 

As I add additional Composite controls to the window, the gap gets even bigger. What can I do to get rid of it?

 

 

You can try to override the function:

protected boolean showTopSeperator() {
    return false;
}
 

  
  
If I do that, it does remove the line. However, as soon as I add a Composite to the shell, the line reappears. –  jasonh Aug 18 '10 at 18:15
Well, it looks like the problem is internal to ApplicationWindow. If you look at ApplicationWindow.java, you'll see an internal ApplicationWindowLayout class that has static final int VGAP = 2; which is added to the y position of every top-level control I add, thus adding a non-sensical white line to the top of the shell. I wonder, how does Eclipse itself avoid this white line from showing up? –  jasonh Aug 18 '10 at 19:09
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值