From the course: Learning GWT

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

UiBinder event handling

UiBinder event handling

From the course: Learning GWT

Start my 1-month free trial

UiBinder event handling

- [Instructor] Another cool feature of ui binder is the ui handler at rule. We skipped over this section in the code previously and we will address it very soon but for now let's comment out these four lines by selecting them and using the keyboard shortcut of command forward slash. I will now demonstrate how to do this in the standard way just to give us a real appreciation of how much easier using ui binder is. First of all, if we wanted to listen to the button we would need to add a click handler to the button in the constructor. So let's do that. So to add a click handler, I'll say button.addclickhandler and then create a new handler right inside the parameter. Use control space to have Eclipse auto generate some suggestions. I'll use the first one. And Eclipse will automatically create the required on click method as part of the click handler class. So in this on click method, we can have the application do something when the button is clicked. Let's simply create an alert for…

Contents