SmartGWT HTMLFlow Contains Image Problem

Just before I developed application using Google Web Toolkit, and encountered a really strange error in SmartGWT’s Label component. If Label contains HTML with image, Label will suffer height miscalculation, causing some part of image is not displayed on screen.

I search around Internet about this issue, and I found one article told me to add a timer that call adjustForContent in HTMLFlow after several miliseconds. And here is the result

final HTMLFlow flowIsi = new HTMLFlow();
flowIsi.setContents(sIsi);
Timer t = new Timer() {
@Override
public void run() {
// TODO Auto-generated method stub
//com.google.gwt.user.client.Window.alert(“hello”);
flowIsi.adjustForContent(true);
}
};
t.schedule(400);

voila, the solution is worked, and now HTMLFlow display it’s contents correctly! I tried to change timer to 300 miliseconds, but it didn’t work, I dunno why. Here is the result after I add timer to my code.

I think this trick worked with SmartGWT Label and HTMLPane.

Leave a Reply

Your email address will not be published. Required fields are marked *