gwt pushButton in UiBinder

会有一股神秘感。 提交于 2019-12-21 07:29:13

问题


I need to create a pushButton(so it's a button with image) in gwt with UiBinder, but I'm not sure how proceed. Here is my ui.xml code:

<g:PushButton ui:field="myPushButton"/>

And in *.java file I defined:
PushButton myPushButton;

How can I add an image to the push button? I've tried the following but won't work:

<g:PushButton ui:field="myPushButton" image="myImage.gif" />

Thanks


回答1:


You can use following code straight from CustomButton Javadoc:

g:PushButton ui:field='pushButton' enabled='true'>
   <g:upFace>
     <b>click me</b>
   </g:upFace>
   <g:upHoveringFace>
     <b>Click ME!</b>
   </g:upHoveringFace>

   <g:downFace image='{downButton}'/>
   <g:downHoveringFace image='{downButton}'/>
 </g:PushButton>

There's more in JavaDoc: http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/CustomButton.html



来源:https://stackoverflow.com/questions/3868785/gwt-pushbutton-in-uibinder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!