4.5. Creating a composite

Composite widgets are just what they sound like—a composite of widgets acting together as if they’re one. The internal structure of a composite is usually hidden from the outside world, and you typically can’t add or remove components unless you build it to be explicitly hidden—a composite is essentially a façade.

You may have already used a composite without knowing about it. TabPanel, which we used in the last chapter’s example, is composed of two separate widgets. There’s a TabBar that contains the tabs you click and a DeckPanel that holds the contents (see figure 4.11). When you click one of the tabs in the TabBar, you want the appropriate widget in the Deck-Panel to be displayed. TabPanel was made as a composite ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.