I am using GridLayout in my GUI application GUI. 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 table element like this -
Label l = new Label(shell, SWT.BORDER); l.setAlignment(SWT.CENTER); l.setText("some text"); l.setLayoutData( gridData );
Now my problem, despite using the verticalAlignment property, the verticalIndent and setAlignment properties on the label itself, I canβt get the text aligned vertically with respect to the grid cell area (25 x 25). I think something is missing. How to achieve vertical alignment in a grid cell?
source share