开发者

GWT Button(Image + Text)

I need to make a round button with some text on it (Centered). For the round button, I'm using an Image and onClick methods, but my problems come when i'm trying to overlap some text (Centered) over the image.

"Like this "

GWT Button(Image + Text)

The text have to be cust开发者_运维知识库omizable, so I can't just make the image previously

Any hints of how to do that?

Thanks in advance.


You can also achieve this using a bit of css

Button b = new Button("Calcular");
b.setPixelSize(200, 127);
DOM.setStyleAttribute(b.getElement(), "background", "transparent url('http://www.greenthumbgraphics.com/images/buttons/shapes/oval.png')");
DOM.setStyleAttribute(b.getElement(), "border", "solid 0px white");
DOM.setStyleAttribute(b.getElement(), "textAlign", "center");
RootPanel.get().add(b);

But there is a problem, button clicks work even in the transparent areas. Also, if you are looking for different images on mouseover and mousedown, then using CustomButton is a better option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜