If you are extending UIComponent and you add a Label component to your custom component it seems you have to use setActualSize() in order for your label to appear. The problem is I don't know what size the label is going to be as it depends on the length of the text and the font size. Sometimes this works:
label.setActualSize(label.getExplicitOrMeasuredWidth(),
label.getExplicitOrMeasuredHeight())
but not always. I'm not sure of the reason for this.
What's the best way to set a label to its actual size?
thanks