Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Draw2D] Zoom with GridLayout help
[Draw2D] Zoom with GridLayout help [message #677063] Tue, 07 June 2011 12:54
Aru  is currently offline Aru Friend
Messages: 1
Registered: June 2011
Junior Member
I'm trying to create a couple of composite figures each with 2 rows of labels. The first row has 3 labels with equal widths and the second row has a label that spans 3 columns.

I'm using GridLayout to layout my figures as BorderLayout and ToolbarLayout didn't work for me. However when I zoom in, spaces appear between my labels.

This is a snippet of my code, I've replaced the createContents() method in Draw2D's ZoomExample.

How can I remove the spaces between the labels?

private static Figure createContents() {	
	Figure contents = new Figure();
	XYLayout layout = new XYLayout();
	contents.setLayoutManager(layout);
	
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 3;
        gridLayout.makeColumnsEqualWidth = true;
        gridLayout.horizontalSpacing = 0;
        gridLayout.verticalSpacing = 0;
        gridLayout.marginWidth = 0;
        gridLayout.marginHeight = 0;

        RectangleFigure rectFigure = new RectangleFigure();
        rectFigure.setBounds(new Rectangle(30, 30, 100, 50));
        rectFigure.setLayoutManager(gridLayout);
        
	Label label1 = new Label("A");
	label1.setBackgroundColor(ColorConstants.blue);
        label1.setOpaque(true);
        rectFigure.add(label1);
	
	Label label2 = new Label("B");
	label2.setBackgroundColor(ColorConstants.red);
        label2.setOpaque(true);
        label2.setOpaque(true);
        rectFigure.add(label2);
	
	Label label3 = new Label("C");
	label3.setBackgroundColor(ColorConstants.green);
        label3.setOpaque(true);
        label3.setOpaque(true);
        rectFigure.add(label3);
	
	Label label4 = new Label("DEF");
	label4.setBackgroundColor(ColorConstants.yellow);
        label4.setOpaque(true);
        label4.setOpaque(true);
        rectFigure.add(label4);
        GridData gridData = new GridData();
        gridData.horizontalSpan = 3;
	rectFigure.setConstraint(label4, gridData);	
	
	contents.add(rectFigure);
	
	return contents;
}
Previous Topic:Lost connections on deletion
Next Topic:Word wrap in draw2d tooltips
Goto Forum:
  


Current Time: Fri Oct 22 01:24:57 GMT 2021

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

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

Back to the top