I am using GridLayout in my SWT GUI app. I have the following GridData defined for each grid cell. The grid cell itself is just a label.
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.heightHint = 25;
gridData.widthHint = 25;
gridData.verticalAlignment = GridData.VERTICAL_ALIGN_CENTER;
gridData.verticalIndent = 10;
And I create each lable element like this -
Label l = new Label(shell, SWT.BORDER);
l.setAlignment(SWT.CENTER);
l.setText("some text");
l.setLayoutData( gridData );
Now My problem is in spite of using verticalAlignment property, verticalIndent property and setAlignment on the label itself, I am not able to get the text align vertically centered with respect to the grid cell area ( 25 x 25 ). I think I am missing something. How can I achieve the vertically centered alignment in a grid cell ?