[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Center a Label in a Node

Hello Cecilia,

sorry for being so late, I don`t know if you still have this problem. I had the same problem, and now I found a solution. Perhaps this helps others, too.

I use GridLayout for the figure with this parameters:
    GridLayout layoutThis = new GridLayout();
    layoutThis.numColumns = 1;
    layoutThis.makeColumnsEqualWidth = true;
    layoutThis.horizontalSpacing = 0;
    layoutThis.verticalSpacing = 0;
    layoutThis.marginWidth = 0;
    layoutThis.marginHeight = 0;

And for the Label I use this GridLayoutData:
    GridData gd = new GridData();
    gd.verticalAlignment = GridData.CENTER;
    gd.horizontalAlignment = GridData.CENTER;
    gd.horizontalIndent = 0;
    gd.horizontalSpan = 1;
    gd.verticalSpan = 1;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;

With this parameters the Label is always in the center of the figure.

Best wishes
Julia