How can I change the font size of a GWT Label object dynamically?
In a GWT project, I want to be able to do something like this, to set the font size that'll be used for an instance of a Label:
public class BigLabel extends Label {
public BigLabel(String s, int i) {
super(s);
setFontSize(i); // sets font size in em units
}
}
But I can't because I can't find any method that does the same job. I can easily use Label.setStyleName
, 开发者_如何学Pythonbut if I do that I have to set it to an absolute value stored in the css file. Is there a way to have a font size that's flexible?
private void setFontSize(double ems) {
getElement().getStyle().setFontSize(ems, Unit.EM);
}
精彩评论