Reputation: 8608
I have one VerticalLayout and I added 5 Image components to it. I would like to know which image component was clicked by user ? Here is my code
myVerticalLayout.addLayoutClickListener(new LayoutClickListener() {
public void layoutClick(final LayoutClickEvent event) {
System.out.println(event.getSource().getClass().getSimpleName());
}
});
But I always get only VerticalLayout instead of user clicked image component. I have no idea how to do it ? Can sombody give me some suggesstions ? Thanks.
Upvotes: 1
Views: 432
Reputation: 8608
Now I found the answer. I use event.getClickedComponent()
to get it. But if user was clicked on empty space of Layout , this method will return null.
Upvotes: 1