Search code examples
cssgwtlayoutpanels

Why we need to use layout panels in GWT when we are already having CSS for layouting?


Why we need to use layout panels in GWT when we are already having CSS for layouting?

e.g in gwt we use layoutpanel to layout StackLayoutPanel

layoutpanel.setWidgetLeftWidth(stackpanel, 5, Unit.PCT, 30, Unit.EM);

Solution

  • Three reasons:

    A. Faster programing.

    B. Cleaner code.

    GWT panels support much more functionality than a div with an absolute/relative positioning. You don't have to use panels: you can use HTML and CSS in a Ui:Binder, but then you will have to do certain things manually. Basically, you will have to program at close to jQuery level.

    GWT panels can be extended, which you cannot do with a div.

    C. Browser compatibility.

    GWT was developed when browsers were much less compatible with each other. It is slowly becoming less of an issue, but differences still exist, and GWT supports even older browsers that are still being widely used.