[英]How to add formatting to a Radio Button in GWT?
I need to format the text alongside a particular Radio Button in gwt, how do I change the formatting for that particular Radio Button ? 我需要在gwt中的特定单选按钮旁边设置文本格式,如何更改该特定单选按钮的格式?
If there is a particular way to do that through java code itself, I don't want to edit xml or directly add css scripts. 如果有通过Java代码本身执行此操作的特定方法,则我不想编辑xml或直接添加CSS脚本。
Also I tried using something like this : 我也尝试使用这样的东西:
rb.addStyleName(Resources.INSTANCE.cssElements().red()); rb.addStyleName(Resources.INSTANCE.cssElements()。red()); rb.addStyleName(Resources.INSTANCE.cssElements().boldfont());
rb.addStyleName(Resources.INSTANCE.cssElements()。boldfont());
But it didn't work. 但这没有用。
Did you call Resources.INSTANCE.cssElements().ensureInjected()
? 您是否致电
Resources.INSTANCE.cssElements().ensureInjected()
?
See this question: When to use GWT ensureInjected()? 看到这个问题: 什么时候使用GWT sureInjected()?
Yes I did Call ensureInjected(). 是的,我确实打电话给sureInjected()。
The following Code did the Job for me :- 以下代码为我完成了工作:-
rb.getElement().getStyle().setColor("blue");
rb.getElement().getStyle().setFontWeight(FontWeight.BOLD);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.