November 2, 2008

How to make nice buttons with GWT

GWT is a perfect tool for web application designing. I like it! Just one thing piss me off... GET doesn't have a lot of nice components, like, for example GWT-EXT or ExtGWT.
This issue is easy to resolve, but who wants to include a lot of other third party javascript code in project? And if you need only few nice components? Do you want to be dependent of all others JS libraries? Sure, not.
Recently, working at some GWT project, we need to add nice looking buttons. We did it, and i liked how easy it is. I would like to share my experience with this approach.
First of all, we decided to use Hyperlinks instead Buttons. It implements ClickListener, so ... we have everything we need.
Thise is a picture, how HyperlinkButton looks:



If you are master with CSS, using the approach, described in sources, you can do any fancy button, you want!

I didn't found a way, how to put a working example directly to the blog, so, i put there a link for a compiled version (if you are lazy to setup eclipse to do it) and you can as well get a HyperlinkButton sources

If you have other ideas, how to do it better, please, give me to know!

1 comment:

goolie said...

Very good post, Viktor!
The thing I'm interested in is how you managed to set different stylenames to different parts of the widget, i.e. HyperlinkButton-left, HyperlinkButton-right etc?