When I embedding Composite
control inside ViewPart
, a vertical margin/padding is added between textbox and button (button is part of another Composite) , as seen on attached picture.
How can I remove it?
public class View extends ViewPart {
public static final String ID = "xyyx.view";
public void createPartControl(Composite parent) {
GridLayout layout = new GridLayout(1, false);
parent.setLayout(layout);
Text infoText = new Text(parent, SWT.BORDER);
GridData gridDataInfo = new GridData();
gridDataInfo.horizontalSpan = 1;
gridDataInfo.grabExcessHorizontalSpace = true;
gridDataInfo.horizontalAlignment = GridData.FILL;
infoText.setLayoutData(gridDataInfo);
new NewComposite(parent, SWT.NONE);
}
public class NewComposite extends Composite{
public NewComposite(Composite parent, int style) {
super(parent, style);
GridLayout layout = new GridLayout(1, false);
setLayout(layout);
Button btn = new Button(parent, SWT.PUSH);
btn.setText("Button");
}
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}
layout.marginHeight = 0; layout.marginTop = 0;
inside NewComposite didn't help – Garlicky