intricacies of Inner Classes

“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(new Button(“Submit”, new ClickListener() {
public void onClick(Widget sender) {
form.submit(); –> Here the final form object is being accessed



Leave a comment

Filed under gwt, Java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s