nits.kk nits.kk - 1 month ago 8
Java Question

Applying Header text (title) to a ScrolledComposite having a GridLayout

I am having a

ScrollledComposite
with Layout set as
GridLayout
and data set as
GridData
. This I am using on a
Graphical editor


I need to add a heading to the composite which I wish to be static in place and not get scrolled up as the content of the scrolled composite is scrolled up.

I tried adding a label in the scrolled composite but as the contents of the grid is populated the label is hidden, which I suppose is due to the grid view taking the space occupied by thw label.

Answer

I solved this by adding a Group as a parent Composite to my ScrolledComposite. The java class Group extends Composite and also has an option to setting the Text. I applied the font data to the text and I was able to add the header.

Comments