How to capture click event in sub-window?

I’m trying to capture the button click event on a button within a subwindow, to be handled by the parent. The parent component (this) implements ClickListenerWindow

newWindow = new Window("test");
MyComponent myComponent = new MyComponent();
newWindow.setContent(myComponent);
newWindow.setModal(true);
myComponent.saveBtn.addClickListener(this);
UI.getCurrent().addWindow(newWindow);

I get the following error:

The method addClickListener(ClickListener) in the type FocusWidget is not applicable for the arguments (this)

Is there some other method for capturing events in sub windows that I’m missing?

Hi,

from your code I assume you’re working on server side. I think you have just imported the wrong Button class in your MyComponent. I guess you’ve imported the GWT class com.google.gwt.user.client.ui.Button instead of com.vaadin.ui.Button which should be used on the server side.

-tepi

Wow good catch, that was exactly the problem. I must have clicked the wrong ‘Button’ import choice in Eclipse.