Pierre Duval
Pierre Duval

Reputation: 23

In GWT, how to create a Style object and associate it with a Widget WITHOUT using a CSS file and WITHOUT UiBinder

I would just like to create a Style object and associate it with a Widget, all in Java.

It is possible to create a Style object like that: Style style = new Style();

It is possible to link a Widget with a Style using: FlowPanel panel = new FlowPanel(); panel.setStyleName("myStyle");

But you need "myStyle" to exist in some CSS file.

It would be nice to be able to do: Style style = new Style("myStyle");

I would like to do everything in Java and avoid the CSS or UiBinder file.

Thank you !

Upvotes: 0

Views: 387

Answers (1)

Dirk
Dirk

Reputation: 1903

You should be able to access the Style element by using

someUiObject.getElement().getStyle()

and then manipulate the style there.

Upvotes: 2

Related Questions