Skip to main content


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 21:03
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 476
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: Tue Mar 19 10:07:41 GMT 2024

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

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

Back to the top