benstpierre
benstpierre

Reputation: 33591

Click listener on image broken in Vaadin 7

I run this code to make a button then add it to a GridLayout.

private Image makeButton(String text) {
    final Image imageButton = new Image(text);
    imageButton.setIcon(new ExternalResource("https://cdn2.iconfinder.com/data/icons/ios7-inspired-mac-icon-set/128/_app_store_128.png"));
    imageButton.addClickListener(new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent event) {
            Notification.show("Hello World");
        }
    });
    return imageButton;
}

However the click event is never called. Any idea how/why this could happen?

Upvotes: 0

Views: 1250

Answers (1)

ZeAL0T
ZeAL0T

Reputation: 709

Use setSource() instead of setIcon().

Upvotes: 0

Related Questions