Disappointing start to GWT - Firefox different than Chrome

136 views
Skip to first unread message

Steve

unread,
Apr 21, 2012, 11:59:20 AM4/21/12
to Google Web Toolkit
I'm trying out GWT and was disappointed to see the following basic
program render very differently on Firefox and Chrome. Am I missing
something?

On Chrome the buttons fill the page. On Firefox the buttons fill
vertically but not horizontally.

Windows 7
GWT 2.4.0
Firefox 11.0
Chrome 18.0.1025.162 m


public void onModuleLoad() {

LayoutPanel layoutPanel = new LayoutPanel();
RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();

rootLayoutPanel.add(layoutPanel);
layoutPanel.setSize("100%", "100%");

Button btnNewButton = new Button("New button");
btnNewButton.setText("btn1");
layoutPanel.add(btnNewButton);
layoutPanel.setWidgetLeftRight(btnNewButton, 0.0, Unit.PX, 0.0,
Unit.PX);
layoutPanel.setWidgetTopHeight(btnNewButton, 0.0, Unit.PX, 50.0,
Unit.PCT);

Button btnNewButton_1 = new Button("New button");
btnNewButton_1.setText("btn2");
layoutPanel.add(btnNewButton_1);
layoutPanel.setWidgetLeftRight(btnNewButton_1, 0.0, Unit.PX, 0.0,
Unit.PX);
layoutPanel.setWidgetBottomHeight(btnNewButton_1, 0.0, Unit.PX,
50.0, Unit.PCT);
}

Qian Qiao

unread,
Apr 21, 2012, 12:11:04 PM4/21/12
to google-we...@googlegroups.com

What's that to do with GWT?

You've effectively added button with position: absolute, without ever
giving it a parent with position: relative so that the browser can
calculate the button's dimentions.

-- Joe

Thomas Broyer

unread,
Apr 21, 2012, 12:17:21 PM4/21/12
to google-we...@googlegroups.com


On Saturday, April 21, 2012 5:59:20 PM UTC+2, Steve wrote:
I'm trying out GWT and was disappointed  to see the following basic
program render very differently on Firefox and Chrome.  Am I missing
something?

On Chrome the buttons fill the page.  On Firefox the buttons fill
vertically but not horizontally.

Windows 7
GWT 2.4.0
Firefox 11.0
Chrome 18.0.1025.162 m


        public void onModuleLoad() {

                LayoutPanel layoutPanel = new LayoutPanel();
                RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();

                rootLayoutPanel.add(layoutPanel);
                layoutPanel.setSize("100%", "100%");

Bad idea. When using a layout panel (RootLayoutPanel in this case), let it manage the position and size of its children (the LayoutPanel here).

Also, RootLayoutPanel is a LayoutPanel, so the additional LayoutPanel here is actually useless.
Reply all
Reply to author
Forward
0 new messages