4.4. Extending a panel

Panels are a subclass of widgets. This means you can use the same technique to extend panels as you’ve seen for widgets. But we need to make a distinction between widgets and panels: panels have a set of methods that allow you to add and remove other widgets. If you extend a panel, then your new widget inherits those panel-specific methods.

 

Should you be extending a panel?

You should only extend a panel if you want the result to look, feel, and act like a panel. This might sound obvious, but extending a panel means a developer can easily add new widgets to it by calling the add(Widget w) method.

If you’re trying to create a new widget that’s really a panel holding a determined set of other widgets, then you should ...

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.