Label not showing in Content Component


Hello everyone. I’m a novice to the JUCE library and have a bit of C++ experience (I work as a C# developer professionally).

I have been trying to get a Label to display in a custom window and I can’t seem to figure it out. Basically I’ve created a new DocumentWindow and a new content Component for it, and then called setContentComponent in the window’s constructor. The window will display, but I don’t see the label.

Below is my code for the content component and the window. In the application’s initialise() method I call setVisible(true) on the the window object. I must be doing something odd as I would think something so simple should have worked. Could anyone offer any advice to me?


class LoggerContentComp : public Component




LoggerContentComp (LoggerWindow* loggerWindow_)

: loggerWindow (loggerWindow_)


Logger::outputDebugString(T(“Creating LoggerContentComp”));

    //invokeDirectly (showRendering, true);

Label* m_textLabel = new Label(T(“lblLogOutput”), T(“HELLO!”));

addAndMakeVisible(m_textLabel, 5);//, <#int zOrder#>)






void resized()




LoggerWindow* loggerWindow;

//Label* m_textLabel;


// and in your cpp…


: DocumentWindow (“SoundSlice Log”,





LoggerContentComp* loggerContent = new LoggerContentComp(this);

setResizable (true, false);

setResizeLimits (400, 300, 8192, 8192);

setContentComponent (loggerContent);//, true, false);

Logger::outputDebugString(T(“Creating LoggerWindow”));

//centreWithSize (getWidth(), getHeight());

//setVisible (true);

//set up label

//m_textLabel = new Label(T(""));

//addAndMakeVisible(m_textLabel);//, <#int zOrder#>)


void LoggerWindow::SetLogger(TextLogger* logger)


m_logger = logger;


TextLogger* LoggerWindow::GetLogger()




Logger::outputDebugString(T(“found logger”));

return m_logger;





setContentComponent (0, true);


void LoggerWindow::closeButtonPressed()


// The correct thing to do when you want the app to quit is to call the

// JUCEApplication::systemRequestedQuit() method.

// That means that requests to quit that come from your own UI, or from other

// OS-specific sources (e.g. the dock menu on the mac) all get handled in the

// same way.

delete this;


m_textLabel->setBounds (0, 0, 100, 20);


Thank you!