Search code examples
javaswtctabitem

How do I show a table inside a CTabItem using the SWT


This is probably a trivial question for most but here goes...

I am using SWT and want to show a table inside a CTabItem (or a TabItem if it's easier). I tried to create the table and use the CTabItem as the parent when doing so, however it doesnt accept this as a parameter (asking me to change CTabItem to Composite).

I figured there must be a way of showing a table inside a tab, I'm just not sure how to do it, can anyone point me in the right direction?


Solution

  • You have to use the (C)TabFolder as parent instead. And on the (C)TabItem you have to call tabItem.setControl(yourTable).