Button,Slider and Label not visible

Below is my code

class MainContentComponent   : public Component

{

public:

    

    MainContentComponent()

    :button1("Click"),

     label1 ("label1","info")

 {

    slider1.setRange(0.0,100.0);

    addAndMakeVisible (&button1);

    addAndMakeVisible(&slider1);

    addAndMakeVisible(&label1);

    setSize (200,100);

 }

    void resize()

    {

        button1.setBoundsRelative (0.05, 0.05, 0.90, 0.25);

        slider1.setBoundsRelative (0.05, 0.35, 0.90, 0.25);

        label1.setBoundsRelative (0.05, 0.65, 0.90, 0.25);

    

    }

private:

    TextButton button1;

    Slider slider1;

    Label label1;

 

};

 

When I build the project , the button,slider and label are not visible. what am I doing wrong.

 

Neha

resized()

This is why everyone should be using the new 'override' keyword - it can catch a lot of typos.

Thanks