Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GridLayout and Panel with strange behaviour
GridLayout and Panel with strange behaviour [message #838891] Sat, 07 April 2012 17:03
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
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?!?!
Previous Topic:[Draw2D] GridLayout column/row sizes
Next Topic:To delete an object in gef using the delete key
Goto Forum:
  


Current Time: Fri Apr 18 21:57:23 EDT 2014

Powered by FUDForum. Page generated in 0.08586 seconds