Summary
GWT provides very few Java methods directly related to style. Rather, they encourage you to define styles in Cascading Style Sheets.
Solution
-
Go to the following directory: "C:\plugin-in-a-box\workspace\<YourProjectName >\src\com\example\commander\plugins\<YourProjectName>\public" (create the "public" folder if it does not exist).
-
Create a CSS file called, say, "special.css" with your own styles. For example:
.crazy_color {color:#FFBB22;font-size:140%;font-weight:bold;}
-
Add the following line to <YourProjectName >.gwt.xml
"special.css"/>
-
In Eclipse, highlight your project and select File > Refresh.
-
In Java, after you create a widget (or while processing an event, set its style to the one that you defined. For example:
@Override protected FormTable doInit() { getLog().debug("Testing CSS"); Label l = new Label("LabelValue"); l.addStyleName("crazy_color"); FormTable ft = new FormTable(); ft.addRow("LabelValue", new Label("Label Value:"), l); return ft;}