Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image in GWT Button [closed]

How do I add image to GWT Button or how do I use Mosaic's Buttons to add image. I can't figure out how to use THIS example in my code. What library do I need to add. I have Mosaic Library in my project and I can use it but the example that they have there does not work for me.

Thanks

like image 347
Maksim Avatar asked Sep 21 '09 21:09

Maksim


2 Answers

If you just want to add an image to a normal GWT Button, then PushButton is the way to go:

PushButton pushButton = new PushButton(new Image("test.png"));
like image 53
Igor Klimer Avatar answered Oct 20 '22 04:10

Igor Klimer


PushButton does not have the same behavior, and you have a prettier solution than creating yourself an image tag :

Image img = new Image("whatever.jpg");
Button button = new Button();
button.getElement().appendChild(img.getElement());
like image 24
Michael Avatar answered Oct 20 '22 04:10

Michael