CustomComponent render problem!

Hi,

I’m testing a CustomComponent which looks something like:

public class SamplePFormPanel extends CustomComponent {
    
    final Panel samplePFormPanel = new Panel("SamplePForm Panel");
    
    @AutoGenerated
    private AbsoluteLayout mainLayout;
   
    public SamplePFormPanel() {
        buildMainLayout();
        Panel samplePFormPanel = new Panel("SamplePForm Panel");
        VerticalLayout mainWindow = new VerticalLayout();
        mainWindow.setSizeFull();
        mainWindow.addComponent(samplePFormPanel);
        mainLayout.addComponent(mainWindow);
        setCompositionRoot(mainLayout);
    }
    
    @AutoGenerated
    private void buildMainLayout() {
        // the main layout and components will be created here
        mainLayout = new AbsoluteLayout();
    }

I use this component the following way:

split.addComponent(new SamplePFormPanel());

However the SamplePFormPanel is not rendered?

But when I use for example the command below:

split.addComponent(new Panel("New Panel"));

the panel labeled “New Panel” is rendered as aspected!

I must be misunderstanding some basics here, but what?

Regards,
Gerard

public SamplePFormPanel() {
buildMainLayout();

    setCompositionRoot(mainLayout);
}

@AutoGenerated
private void buildMainLayout() {
// the main layout and components will be created here
mainLayout = new AbsoluteLayout();
mainLayout .setSizeFull();

    VerticalLayout mainWindow = new VerticalLayout();
     
     Panel samplePFormPanel = new Panel("SamplePForm Panel");
     samplePFormPanel .setContent(mainWindow );

    mainLayout.addComponent(samplePFormPanel ,"top:0px;left:0px;");
}

Hi,

Thanks!

Regards,
Gerard