Assuming they are standard Scene2d widgets, just use setVisible (true) when you want to see them, and setVisible (false) when you don't.
Something like that ...
public void SetScore(int score) { if(score<0) { highScore.setVisible(false); lockImage.setVisible(true); } else { highScore.setVisible(true); highScore.setText(Integer.toString(score)); highScore.validate(); lockImage.setVisible(false); } }
If they occupy the same screen space, you might want to push them onto the stack.
source share