6.4. Applying style with UiBinder

If you’ve been following along with the example, at this point you’ve created an XML template, created a Java class for your widget, and used UiBinder to tie the two together. Along the way we purposely avoided discussing CSS styling, which we’ll talk about now.

At the beginning, our designer delivered some CSS code with the HTML, and we need to decide how to handle this. We could include an HTML <link> in the web page hosting our application and have it point to the CSS file as follows:

<link href="/css/LoginDialogBox.css" rel="stylesheet" type="text/css" />

This will work, but you can do better. Ideally, you’d have this stylesheet code available to you as a CssResource. This would give you syntax validation, ...

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.