All is on the title , I've tried to follow step by step the example provided by Nathan Sweet ( Libgdx main contributor ) to create a window in Scene2d but I come up with an unexpected result :
Like you can see the text gose out the window , here is my code for the window :
Window window = new Window("The new Window commIng up", skin_deff);
window.setPosition(400, 200);
window.pack();
// putting stuff together
table.debug();
table.add(heading).colspan(3).expandX().spaceBottom(50).row();;
table.add(scrollPane).uniformX().expandY().top().left();
table.add(window).padLeft(30);
// table.add(play).uniformX();
table.add(back).uniformX().bottom().right().padLeft(550);
stage.addActor(table);
This is the example of Nathan Sweet that I'm trying to follow :
Code :
label.setPosition(100, 200);
stage.addActor(label);
Window window = new Window("[RED]Multicolor Bla Bla Bla[GREEN] Title", skin);
window.setPosition(400, 200);
window.pack();
stage.addActor(window);
I've found the solution , the issue was in my table layout :
table.debug();
table.add(heading).colspan(3).expandX().spaceBottom(50).row();
table.add(scrollPane).uniformX().expandY().top().left();
table.add(window).top();
// table.add(play).uniformX();
table.add(back).uniformX().bottom().right();
stage.addActor(table);
Instead of
table.debug();
table.add(heading).colspan(3).expandX().spaceBottom(50).row();;
table.add(scrollPane).uniformX().expandY().top().left();
table.add(window).padLeft(30);
// table.add(play).uniformX();
table.add(back).uniformX().bottom().right().padLeft(550);
stage.addActor(table);
The padLeft
applied to the window
and the back button was forcing the text to overlap the window .
And now the result looks much better :) :