4

What's the difference between TabPanel and TabLayoutPanel in GWT? I can't find the answer in Google and it is difficult to understand reading docs

maneesh
  • 1,692
  • 1
  • 14
  • 18
Anton Kasianchuk
  • 1,177
  • 5
  • 13
  • 31

2 Answers2

11

TabLayoutPanel is a layout panel: it's sized from the outside-in, it has to be given explicit dimensions and be notified when they changed (RequiresResize), and similarly will resize its children and notify them when it does so (ProvidesResize).

TabPanel is not; it's sized from the inside-out: it'll resize itself depending on the size of the widget in the selected tab.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
10

Addition to what Thomas is saying

In GWT, To layout the widgets in the screen there are two kind of panels: Panels ( Eg: TabPanel ) and Layout Panels ( Eg: TabLayoutPanel )

Panels or Non-layout panels

These panels (TabPanel, DockPanel, Horizontal panel, Vertical Panel, AbsolutePanel ... ) allow you to layout widgets in an explicit manner. It will render the widgets as imagined ( provided correct imagination ;) ). Its child widgets are not automatically resized when the browser resizes.

Layout panels

These Panels (TabLayoutPanel, DockLayoutPanel, ScrollPanel, FlexTable, SplitLayoutPanel... ) allow you to layout widgets in the explicit manner but also resize the child widget when the browser resizes as each of them implements RequiresResize and/or providesResize provided you maintain Layout panels hierarchy throughout and provide the size of panels and widgets in percentages.

Sources: GWT Docs and Personal Experience

Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55