Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change GWT's widget CSS values?

Tags:

java

css

gwt

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 property 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.

like image 489
Xorty Avatar asked Dec 17 '22 18:12

Xorty


1 Answers

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).

like image 53
Hilbrand Bouwkamp Avatar answered Dec 19 '22 08:12

Hilbrand Bouwkamp