Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gwt pushButton in UiBinder

Tags:

java

gwt

uibinder

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

like image 727
ohana Avatar asked Oct 06 '10 00:10

ohana


1 Answers

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

like image 98
Ilia Akhmadullin Avatar answered Nov 02 '22 22:11

Ilia Akhmadullin