Muhammad Hewedy
Muhammad Hewedy

Reputation: 30056

GWT: how to use default (standard) styles + user supplied styles?

I have some combobox that is defaulted to gwt-ListBox style. I need to use this style plus my own style that I wrote in module_name.css when I use cmbobox1.setStyleName("user-defined-style");

I find that the style gwt-ListBox is ignored.

Upvotes: 0

Views: 192

Answers (3)

Xorty
Xorty

Reputation: 18861

When you use "setStyleName" you are replacing all styles of element. When you use "addStyleName" you're adding styles to existing styles.

Upvotes: 0

TxANG
TxANG

Reputation: 190

With complex widgets (those who have dependant styles) like DialogBox you should use:

void setStylePrimaryName(java.lang.String style)

to set base style and update all dependant styles.

Upvotes: 0

Javier Ferrero
Javier Ferrero

Reputation: 8811

Use:

void addStyleName(java.lang.String style) 

Adds a secondary or dependent style name to this object.

Upvotes: 2

Related Questions