UiBinder中的gwt pushButton

oha*_*ana 12 java gwt uibinder

我需要创建一个按钮(因此它与图像的按钮)在gwtUiBinder,但我不知道如何进行.这是我的ui.xml代码:

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

在*.java文件中我定义了:
PushButton myPushButton;

如何将图像添加到按钮?我尝试了以下但不起作用:

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

谢谢

Ili*_*lin 15

您可以直接从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>
Run Code Online (Sandbox Code Playgroud)

JavaDoc还有更多内容:http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/CustomButton.html