Hi,
I am relatively a beginner in java and I am learning the google web toolkit (GWT). I saw this code snippet in their tutorial. I don't understand what is going on. I seems to be creating a ClickHandler Object in the constructor for a new Button object, and in the ClickHandler object we are overriding the onClick method? Is that what it is doing? Can we add more methods with this style, or just modify existing ones?
package com.google.gwt.sample.hello.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Hello World application.
*/
public class Hello implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
Window.alert("Hello, AJAX");
}
});
RootPanel.get().add(b);
}
}
Thanks