0
\$\begingroup\$

I have a (Scene2d) Table containing a Label, both added to a Stage, and I'm properly calling stage.act(float) and stage.draw(). However, if I modify the text of the Label (using setText()) to be wider than the Table, the Table doesn't automatically widen, which I can tell because it's being rendered with a background. This is surprising to me since the setText(CharSequence) method calls invalidateHierarchy(), which I'd assume would be sufficient. I suspect if I were to then call pack() on the Table instance it would be sized correctly, but that seems like a code smell to me. (Calling pack() on the Label itself appears to do nothing.)

Should I be calling pack() on the Table anyway? Or should I be recursing up the parent hierarchy of the Label calling pack() as I go? Or is there some other sane way of handling this...

Thanks!

\$\endgroup\$
2
  • \$\begingroup\$ Post your code :) \$\endgroup\$
    – Green_qaue
    Commented Feb 13, 2017 at 10:36
  • \$\begingroup\$ When adding label to table, do you use expand or fill? \$\endgroup\$ Commented Feb 26, 2017 at 16:47

0

You must log in to answer this question.

Browse other questions tagged .