Text/Labels Rendering Issue

I’ve been meddling with this for a while, and it seems like I’m missing something basic, but I’m not having any luck figuring it out.

I’ve got some simple along the lines of:
[java]Panel panel = new Panel(screen, UIDUtil.getUID(), Vector2f.ZERO, new Vector2f(200, 200));
hudLayer.addChild(panel);

ButtonAdapter button = new ButtonAdapter(screen, UIDUtil.getUID(), new Vector2f(15, 15), new Vector2f(100, 25));
button.setText(“testing”);
panel.addChild(button);

Label label = new Label(screen, UIDUtil.getUID(), new Vector2f(10, 10f), new Vector2f(100, 100));
label.setText(“First Text”);
label.setFontColor(ColorRGBA.White);
hudLayer.addChild(label);[/java]

Which shows up on the screen like so:
Before

Obviously, the text is messed up, but the panel rendered correctly.

But when I mouse over or click on the button, the text fixes itself:
After

What am I forgetting to do to get the text to render correctly from the start?

From what I can see of your code, you have at least screen/hudLayer/panel/.
Problem maybe comes from all those layers of containers.

I have lots of the following and they work fine:

  • screen/window
  • screen/window/scroll
  • screen/window/tab
  • screen/window/tab/scroll

Also, I don’t know if it is still required, but I always fill a container or element before adding it to it’s upper container, and never the opposite.

Is that a different font? (i.e have you created your own styles?). I have had some odd troubles with some fonts before now, so perhaps that could be it.

Also are you able to post a complete runnable example?