Reputation: 173
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
, but 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?
Upvotes: 2
Views: 8488
Reputation: 64541
private void setFontSize(double ems) {
getElement().getStyle().setFontSize(ems, Unit.EM);
}
Upvotes: 10