Search code examples
javaswtctabitem

SWT Use Composite from File


I am trying to use a composite that I have created in a separate file in my app. I am unsure how to set the control of my tab to the compsoite file.

Package: hm_forms Composite File: Comp_HM.java Main File: Frm_Main.java Control: tabHM

I am thinking its got to be close to.

Composite Comp_HM = hm_Forms.Comp_HM;
tabHM.setControl(Comp_HM);

Solution

  • Composite Comp_HM = hm_Forms.Comp_HM;
    tabHM.setControl(new Comp_HM());
    

    You have to create an instance of your custom composite and pass it into the setControl method.