How can I change GWT's widget CSS values?
Basically, I like default theme widgets. However, I need to change font size on DecoratedStackPanel widget.
I think it should be possible with something like this:
decoratedStackPanel.getElement().getStyle().setProperty("fontSize", "12pt");
However, "fontSize" is not valid name for pr开发者_Python百科operty and I didn't find way how to get all element's properties. Therefore, I don't know correct property name.
Any ideas?
Please, don't post about inheriting widget or writing custom CSS. I like default one but the font size. This should be possible afaik.
fontSize is correct, the best way to use is as follows:
decoratedStackPanel.getElement().getStyle().setFontSize(12, Unit.PT);
But i'm not sure this will result in what you want. it sets the font size on the whole panel, and if another font size is set on a child element that one will be used in that element. In that case a css entry for the specific element would be better. For example:
.gwt-DecoratedStackPanel .gwt-StackPanelItem {
font-size:12pt !important;
}
(!important will force to use this specific font-size setting, and should only be used if you want to make sure this font-size is used. First test without).
You can use DOM class to set style attributes..
DOM.setStyleAttribute(decoratedStackPanel.getElement(), "fontSize", "12pt");
fontSize would be translated to font-size
精彩评论