3.8. Styling components
You can style widgets in the following five ways:
- Programmatically, such as saying button.setWidth("100px"); in your code
- Low level via the DOM, by writing in your code button.getElement().getStyle().setWidth(100);
- By using Cascading Style Sheets, which means placing a definition in your CSS file .gwt-button{width:100px;}
- By inheriting one of GWT’S built-in themes in your module definition
- By using an expression language
The latter point on expression language we’ll leave until chapter 6’s discussion on GWT’s UiBinder (declarative user interface design). We’ll use the rest of this chapter to look at the other.
If you had no styling then the BasicProject application would look as uninspiring as figure 3.8. (You’ll ...
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.