[FIXED]Libgdx - Layout Issue With Table(Window)

Guys im having a problem. I tried solving this for 3 days… Some friends gave some ideas but none of them solved.
Heres the thing,

I have a class Named Enemy
The Class Gnome Extends Enemy
The Class Gnome have a Class Named “Trade Diamonds” :
http://pastebin.java-gaming.org/d41100c1a8b

The Class Trade Diamonds Extends NpcWindow :
http://pastebin.java-gaming.org/4110c1a1b8a

So far, so good.
Now i can click in the Gnome And trade items with him…BUT, When i click in an item, a label Text changes, And when it does, the screen layout goes crazy for some seconds and then goes back to normal…

http://imagizer.imageshack.us/v2/1024x768q90/132/u7bh.jpg

In The Screenshot, what happens is that i clicked in Mana Potion and the Label Text Changed, for some time(maybe half a second?) the screen stays like that.
I had to be fast with the Print Screen.

Anyway, The resize() method is always called because its inside the Gnome Class and i think i shouldnt have done that… But for now i will keep like that until i can solve that.Unless the problem is that the resize() is always called , which after some tests, i figure its not.

The problem also happens if i call invalidateHierarchy in Window.
I tried calling invalidate in everything, layout etc…

Im unsure whats happening…

Heres a video to illustrate.

Any help/Tip is totally appreciated.

What exactly is the purpose of the resize() method? there are a lot of wacky numbers in it

Wreed Thanks for the reply.
Well,
Let me explain one by one :

  This One should set the Label Position out of the tables, but its currently not in use, so ignore those 3 lines below.
    //Labels
    float adjustX = Gdx.graphics.getWidth() / 1.3333f;
    float adjustY = Gdx.graphics.getHeight() / 1.5f;
    //adjustX = adjustX - (tradeInformation.getText().length() * tradeInformation.getFontScaleX());

    tradeInformation.setPosition(adjustX, adjustY);
    
    //Tables

   Those two lines calculate 5% of the total width, so i can create a border.
    float adjustXiLimit = 0;
    adjustXiLimit = (Gdx.graphics.getWidth() * 5) / 100;


    Those two lines calculate 8% of the total height, so i can create a border.
    float adjustYiLimit = 0;
    adjustYiLimit = (Gdx.graphics.getHeight() * 8) / 100;

//Calculate Bounds
//Right Table
rightTable.setBounds((Gdx.graphics.getWidth() / 2), adjustYiLimit, (Gdx.graphics.getWidth() / 2) - adjustXiLimit, (Gdx.graphics.getHeight() / 2) - adjustYiLimit);
//rightTable.setSize(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight());

    //Left Tables
    topLeftTable.setBounds(adjustXiLimit, (Gdx.graphics.getHeight() / 2), (Gdx.graphics.getWidth() / 2) - adjustXiLimit, (Gdx.graphics.getHeight() / 2) - adjustYiLimit);
    //topLeftTable.setSize(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

    bottomLeftTable.setBounds(adjustXiLimit, adjustYiLimit, (Gdx.graphics.getWidth() / 2) - adjustXiLimit, (Gdx.graphics.getHeight() / 2) - adjustYiLimit);
    //bottomLeftTable.setSize(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

    //Window 
    getWindow().setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

Because the background of the window have borders, i had to calculate a border.
Does that help?

The rest is just border calculations.

Those make sense for the original calculation but why after each click to healthTradeSlot ?

Your code is pretty… suboptimal. You put stuff in a table and then position it later. The table positions things when it lays out, so the positions you set in resize() are lost. You can only do this reliably by overidding Table#layout and doing it after you call super, but this is generally a bad idea. Use padding in the table constraints to inset your actors and let the table size and position everything.

You add 3 actors to the window (which is a table) which means you get 3 columns (like the screenshot on the right). You probably want to add(), row(), add(), add() so your first row has 1 column and your second has 2. Read the tablelayout docs:

Guys!

Thanks a lot !!!

http://imageshack.com/a/img197/8756/by3q.jpg

When i was adding to the window,in one of the tests, i did getBottomTable(), and i didnt notice i had direct access to the table…
Well now i know, because it does extend Table.

Wreed, actually that resize() in each time i click was for test.