import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.RootPanel; public class Client implements EntryPoint { public void onModuleLoad() { Button button = new Button("Click me"); RootPanel.get().add(button); button.addClickHandler(new ClickHandler() { @Override final public void onClick(ClickEvent event) { } }); } } 

1 answer 1

Find the desired Element and then .getStyle().setBackgroundColor(...) , for example. Or through toggleClassName(...) change the class that is declared in CSS.

 Element el = Document.get().getElementById("my-div"); el.getStyle().setBackgroundColor("#ff0000"); // или el.toggleClassName("my-red-class"); // в CSS: .my-red-class { background-color: #ff0000 }