Slick Forums

Discuss the Slick 2D Library
It is currently Wed Jun 26, 2019 1:36 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Sep 30, 2013 3:31 pm 

Joined: Sat Mar 30, 2013 12:41 am
Posts: 22
When I call textArea.setSize(w,h) in my ResizableFrame's layout function it get's stuck in a layout loop:
Only thing I find odd is that I don't see a TextArea in the stack???

WARNING: layout loop detected - printing
1: de.matthiasmann.twl.GUI@1e4f430f
2: org.pokemonium.client.ui.GUIPane@65bb9d54
3: org.pokemonium.client.ui.HUD@5629fa
4: org.pokemonium.client.ui.frames.PokedexDialog@18dddc42
5: org.pokemonium.client.ui.components.Image@da77dcf
6: org.pokemonium.client.ui.components.Image@6f34a809
7: org.pokemonium.client.ui.components.Image@6a041fe8
8: org.pokemonium.client.ui.components.Image@34caeeb8
9: org.pokemonium.client.ui.components.Image@76fe8d1b
10: org.pokemonium.client.ui.components.Image@41e224a5
11: org.pokemonium.client.ui.components.Image@65d3ee6d
12: org.pokemonium.client.ui.components.Image@3cca6a55
13: org.pokemonium.client.ui.components.Image@d0b11a1
14: org.pokemonium.client.ui.components.Image@51b267b7
15: org.pokemonium.client.ui.components.Image@17b74948
16: org.pokemonium.client.ui.components.Image@22c2222
17: org.pokemonium.client.ui.components.Image@1f74e74b
18: org.pokemonium.client.ui.components.Image@33fcfd0f
19: org.pokemonium.client.ui.components.Image@2649fe73
20: org.pokemonium.client.ui.components.Image@43e043a8
21: org.pokemonium.client.ui.components.Image@3879ed68

I have used a TextArea in another ResizableFrame as well, but don't have a layout function there (yeah I should do it, but it was one of the the first things I tried after finding TWL). The other TextArea's don't give the layout loop though and when I remove the setSize of the textArea the layout loop is gone.

I also tried using setMinSize and setMaxSize in the layout function, but it doesn't seem to obey to that.

lore.setMinSize(0, 0);
lore.setMaxSize(192, 90);
System.out.println(lore.getWidth() + " " + lore.getHeight() + " " + lore.getMinWidth() + " " + lore.getMinHeight());

This prints:
111 35 192 90          <- First time layout function is called, rest are all 519 377 0 0
519 377 0 0
519 377 0 0

PostPosted: Tue Oct 01, 2013 6:42 pm 
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
By default ResizableFrame's layout() method calls layoutChildFullInnerArea() for each children, so you don't really need to override the layout method if this is what you want.

But with the amount of information you posted I can't help you at all.

Make sure that you only call setSize/setPosition of Widgets which are direct children.
You can try to debug that by setting a break point on childInvalidateLayout() to see from where it is invoked.

One thing to check is the getPreferredHeight() on the TextArea, currently TextArea calls invalidateLayout() when it's required height doesn't match it's actual size. The reason for this is that the height depends on it's width (flow text). Normally this is not an issue when it's placed inside a ScrollPane.

TWL - The Themable Widget Library

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group