我需要使用 UiBinder
在 gwt
中创建一个按钮(因此它是一个带有图像的按钮),但我不确定如何进行。这是我的 ui.xml
代码:
<g:PushButton ui:field="myPushButton"/>
在 *.java 文件中我定义了:
按钮 myPushButton;
如何向按钮添加图像?我已经尝试了以下但不起作用:
<g:PushButton ui:field="myPushButton" image="myImage.gif" />
谢谢
最佳答案
您可以直接使用 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>
JavaDoc 中还有更多内容:http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/CustomButton.html
关于java - UiBinder 中的 gwt 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3868785/