hi,
i figured some problems today.
i create a figure like this:
public static IFigure createNamePanel() {
Panel p = new Panel();
GridLayout grid = new GridLayout(1, false);
grid.horizontalSpacing = 0;
grid.verticalSpacing = 0;
grid.marginHeight = 0;
grid.marginWidth = 0;
p.setLayoutManager(grid);
Label lblName = new Label("test");
lblName.setOpaque(true);
lblName.setBackgroundColor(SWTResourceManager
.getColor(SWT.COLOR_DARK_MAGENTA));
lblName.setForegroundColor(SWTResourceManager.getColor(SWT.COLOR_RED));
p.add(lblName, new GridData(GridData.FILL_HORIZONTAL));
p.setBorder(new LineBorder(SWTResourceManager.getColor(SWT.COLOR_BLACK),
1));
return p;
}
everything resolves as expected
as i want to extend this figure i created an own class for it...
public class NamePanel extends Panel {
private Label lblName;
public NamePanel() {
super();
GridLayout grid = new GridLayout(1, false);
grid.horizontalSpacing = 0;
grid.verticalSpacing = 0;
grid.marginHeight = 0;
grid.marginWidth = 0;
setLayoutManager(grid);
lblName = new Label();
lblName.setOpaque(true);
lblName.setBackgroundColor(SWTResourceManager
.getColor(SWT.COLOR_DARK_MAGENTA));
lblName.setForegroundColor(SWTResourceManager.getColor(SWT.COLOR_RED));
add(lblName, new GridData(GridData.FILL_HORIZONTAL));
setBorder(new LineBorder(SWTResourceManager.getColor(SWT.COLOR_BLACK),
1));
}
}
and this one does not stretch the label to full widht... WHY?!?!