I'm kind of new to the LibGDX API, and I was trying to organize labels and ImageButtons inside tables (and tables inside those tables). When I run the app, the ImageButtons are not being drawn onto the screen.
I've searched everywhere and couldn't find an answer, so I'd really appreciate help.
EDIT: It might happen because I am using tables inside tables, but I didn't find anything about nested tables, or anything like that to be honest.
I call a method in render to keep the labels' text changing that looks like this:
public void drawTable(){
final Table scrollTable = new Table();
scrollTable.addActor(canbtn);
scrollTable.row();
//other buttons
Label.LabelStyle style = new Label.LabelStyle(font, Color.WHITE);
Label.LabelStyle style2 = new Label.LabelStyle(font2, Color.WHITE);
CustomLabel amtLabel = new CustomLabel("" + (int)(game.tot.getSum()), style);
CustomLabel mizcoins = new CustomLabel("Mizcoins", style2);
CustomLabel mpsCount = new CustomLabel(game.totMPS + " MPS", style2);
PerSec can = game.boosts.get("Can").getPerSec();
Table t = new Table();
t.add(drawer(can, canbtn));
t.row();
scroller = new ScrollPane(t);
table = new Table(); //the container table
table.setFillParent(true);
table.add(amtLabel).padTop(50);
table.row();
table.add(mizcoins);
table.row();
table.add(mpsCount);
table.row();
table.add(scroller).fill().expand();//.space(350).padBottom(10);
}
And the drawer() function:
public Table drawer(PerSec perSec, ImageButton imgbtn){
Label.LabelStyle style = new Label.LabelStyle(font2, Color.WHITE);
Label.LabelStyle style2 = new Label.LabelStyle(font2, Color.WHITE);
Label.LabelStyle style3 = new Label.LabelStyle(font2, Color.RED);
CustomLabel nameLabel = new CustomLabel(perSec.getType(), style);
CustomLabel priceLabel = new CustomLabel("Price: " + perSec.getPrice(), style2);
CustomLabel addsLabel = new CustomLabel("Adds: " + perSec.getDefAddPerSec(), style2);
CustomLabel youHaveLabel = new CustomLabel("You Have: " + perSec.getAmt(), style3);
Table mainTable = new Table();
Table smallTable = new Table();
smallTable.add(priceLabel);
smallTable.row();
smallTable.add(youHaveLabel);
mainTable.add(nameLabel);
mainTable.add(imgbtn);
mainTable.row();
mainTable.add(smallTable);
mainTable.add(addsLabel);
return mainTable;
}