如何在GWT标签中插入元素(How to insert Element in GWT Label)

编程入门 行业动态 更新时间:2024-10-07 11:25:21
如何在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>

更多推荐

本文发布于:2023-08-07 17:39:00,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:元素   标签   如何在   GWT   Label

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!