I want to center align the column group text, so provided the SWT.CENTER style while creating the "GridColumnGroup" similar to the way we provide for GridColumn. However even after providing the CENTER style, column group text is shown Left aligned.
Code I tried:
GridColumnGroup columnGroup = new GridColumnGroup(grid,SWT.CENTER);
columnGroup.setText("Column Group");
GridColumn column1 = new GridColumn(columnGroup,SWT.CENTER);
column1.setText("Column 1");
GridColumn column2 = new GridColumn(columnGroup,SWT.CENTER);
column2.setText("Column 2");
[Nebula Grid column and column group rendering with above code ] 2 Any idea what I am missing here ?
Thanks
The style
SWT.CENTER
does not propagate to theGridHeaderRenderer
of the column group. However, void setHorizontalAlignment​(int alignment) method ofGridHeaderRenderer
allows you to center the text.