package com.mycompany.project.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class ImageViewer implements EntryPoint {
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();
{
final FocusPanel focusPanel = new FocusPanel();
rootPanel.add(focusPanel, 142, 72);
focusPanel.setSize("338px", "253px");
{
final Label label = new Label();
focusPanel.add(label);
label.setText("New Label");
}
}
}
}
Congratulations -- you caught one of the more embarassing bugs I've
shipped in recent memory! It looks like the default implementation of
FocusImpl.createFocusable() has a block-copy bug that sets the
FocusPanel's default font-size to 0. I believe we managed to miss this
because our samples have font sizes set on the elements added to
FocusPanels, Menus, and Trees, which hides the problem.
Which leads us to a workaround: set the font size (either in code or
in CSS) of the widget that you add to a FocusPanel, and it will
override the default that it inherits.
joel.