Reputation: 41
i want to make a layout that be visible on mouse over and hide automatically on mouse out. i try this code but it not give me any result;
public class DemoLayout extends VerticalLayout implements MouseOverHandler,
MouseOutHandler,MouseUpHandler {
/**
*
*/
private static final long serialVersionUID = 7610044813670041530L;
public DemoLayout() {
super();
}
@Override
public void onMouseOver(MouseOverEvent event) {
// TODO Auto-generated method stub
System.out.println("Mouse over");
}
@Override
public void onMouseOut(MouseOutEvent event) {
// TODO Auto-generated method stub
System.out.println("Mouse out");
}
@Override
public void onMouseUp(MouseUpEvent event) {
// TODO Auto-generated method stub
System.out.println("Mouse up");
}
}
vaadin doesn't support layout mouse listener? how can i implement this feature? thank you
Upvotes: 2
Views: 619
Reputation: 4967
You have two options:
Depending on your exact use case, you could probably just use CSS and the :hover pseudo class.
If :hover doesn't work then you could use the excellent Mouse Event Extension addon.
Upvotes: 1
Reputation: 15528
I may be wrong, but I don't know of such listeners for layouts up to Vaadin 7.4.3. The good news is that you have at least a few options:
com.google.gwt.event.dom.client
package which is bundled in the vaadin-client jar. You're, probably unintentionally, mixing client-side & server-side classes which is most likely not what you're after. However you can try to create your own widget and implement those handlers on the client side as suggested here and/or hereUpvotes: 1