“One Cannot refer to a non-final variable form inside an inner class defined in a different method”
public void onModuleLoad() {
// TODO Auto-generated method stub
final FormPanel form = new FormPanel(); –> Has to be final in order to be accessed from an inner class method.
VerticalPanel vpanel = new VerticalPanel();
vpanel.add(form);
vpanel.add(new Button(“Submit”, new ClickListener() {
public void onClick(Widget sender) {
form.submit(); –> Here the final form object is being accessed
}
}));
}
No comments:
Post a Comment