Labels


#1

I’m trying to use some labels for my project, but they seem to be invisible or something. Do you guys know something about this?
This is the code I used:

-first : adding the text label1(“A”)
-second: initializing

label1.setColour (Label::textColourId, Colours::palegreen);
label1.setBounds(10, 10, 200, 20);
label1.setFont(Font(10.0f));
addAndMakeVisible (&label1);

Am I missing something? Could it be that another component is messing with this one? My UI size is 250x450.


#2

The first constructor argument is the Component’s name, this is an internal value used to identify it, it’s not actually the text that is displayed. Wither supply the display text as the second argument or use the Label::setText() method.


#3

Awesome, it worked, thanks!