如何在GWT标签中插入元素(How to insert Element in GWT Label)
我正在使用GWT UiBinder,我想创建以下Label
--------------------------------------------
您只能上传.jpg图片
--------------------------------------------
<g:Label ui:field="imgInfo">You can upload only <b>.jpg</b> images</g:Label>但当然这是不正确的例子。 我想使用Label,因为我想添加PopupPanel
final PopupPanel popupImgInfo = new PopupInfo("Max size of the imagde:10Mb"); @UiHandler("imgInfo") void doProtocol(MouseOverEvent event) { popupImgInfo .setPopupPositionAndShow(new PopupPanel.PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { int left = imgInfo.getAbsoluteLeft(); int top = imgInfo.getAbsoluteTop() - 120; popupImgInfo.setPopupPosition(left, top); popupImgInfo.setWidth("400px"); } }); } @UiHandler("imgInfo") void doProtocolHide(MouseOutEvent event) { popupImgInfo.hide(); }所以我的问题是如何在Label中插入html元素,或者你可以提供其他解决方案,使文本在GWT Label中变为粗体。
I'm using GWT UiBinder and I want to create the following Label
--------------------------------------------
You can upload only .jpg images
--------------------------------------------
<g:Label ui:field="imgInfo">You can upload only <b>.jpg</b> images</g:Label>But of course it is incorrect example. I want to use Label, because I want to add PopupPanel
final PopupPanel popupImgInfo = new PopupInfo("Max size of the imagde:10Mb"); @UiHandler("imgInfo") void doProtocol(MouseOverEvent event) { popupImgInfo .setPopupPositionAndShow(new PopupPanel.PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { int left = imgInfo.getAbsoluteLeft(); int top = imgInfo.getAbsoluteTop() - 120; popupImgInfo.setPopupPosition(left, top); popupImgInfo.setWidth("400px"); } }); } @UiHandler("imgInfo") void doProtocolHide(MouseOutEvent event) { popupImgInfo.hide(); }So my problem is how to insert html Element in Label or you can provide other solutions to make text bold in GWT Label.
最满意答案
使用HTML小部件而不是Label小部件:
<g:HTML ui:field="imgInfo">You can upload only <b>.jpg</b> images</g:HTML>Use a HTML widget instead of a Label one:
<g:HTML ui:field="imgInfo">You can upload only <b>.jpg</b> images</g:HTML>更多推荐
发布评论