4.2. Creating a new widget from the DOM

It should be a rare occasion where you need to create a widget directly from the DOM—because most DOM elements are covered by GWT already, and each new version of GWT increases the coverage. For example, GWT 2.2 brought in the Inline-Label to wrap the span element, and GWT 2.3 wraps the canvas element.

The only time you need to think of doing this is when GWT hasn’t done it for you. But the fact that GWT now provides a Canvas widget could have changed this chapter (com.google.gwt.canvas.client.Canvas). When we started writing, we’d written this section to show how to provide a DOM element that was missing. But let’s stick with our version here, because it’s useful to see how to start building a widget, ...

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.