I'm trying to create a simple Canvas that shows a static image. Here is the code for my Canvas subclass. It works, but not always the first time. Sometimes the Canvas is blank until I nudge the browser window at which point the image appears.
SmartClient Version: SC_SNAPSHOT-2010-12-15/EVAL Deployment
SmartClient Version: SC_SNAPSHOT-2010-12-15/EVAL Deployment
Code:
package com.islandpacific.gui.client;
import com.smartgwt.client.types.ImageStyle;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.layout.VLayout;
public class PricingTab extends Canvas {
protected void onInit() {
super.onInit();
VLayout myLayout = new VLayout(10);
myLayout.setWidth100();
myLayout.setHeight100();
Img comingSoon = new Img("customimages/coming-soon.jpg");
comingSoon.setImageType(ImageStyle.CENTER);
myLayout.addMember(comingSoon);
addChild(myLayout);
}
}