Я только что попробовал ваш код (с небольшой настройкой, чтобы исправить ошибку компиляции), и он отображает оба виджета. Я пробовал это в GWT 2.0.
Вот код, который я использовал, который работает. Обратите внимание на разницу имен в конструкторе.
public class MyView extends Composite
{
private VerticalSplitPanel mainPanel=new VerticalSplitPanel();
public MyView()
{
mainPanel.setSize("100%", "100%");
mainPanel.setSplitPosition("50%");
// Add some content
String randomText = "This is some text to show how the contents on either "
+ "side of the splitter flow. "
+ "This is some text to show how the contents on either "
+ "side of the splitter flow. "
+ "This is some text to show how the contents on either "
+ "side of the splitter flow. ";
mainPanel.setTopWidget(new HTML(randomText));
mainPanel.setBottomWidget(new HTML(randomText));
initWidget(mainPanel);
}
}
А вот как я это применил.
public void onModuleLoad() {
RootPanel.get().add(new MyView());
}