Panel and mouse event

Hey !

How can I implement a mouse event (right mouse), on a panel?

What is wrong in the code

I write: (no call from the method getActions and handleAction by clicking the mouse)

public class TestComponent extends CustomComponent implements Action.Handler {
private static final Action ADDA = new Action(“Group”);
private static final Action ADDV= new Action(“Article”);

private static final Action actionsmain = new Action
{ ADDA , ADDV};

buildLayout{
HorizontalLayout horlayout = new HorizontalLayout();

Panel menuPanel = new Panel(“Test”);

menuPanel.addActionHandler(this);
menuPanel.addListener(this);
horlayout.addComponent(menuPanel);

public Action getActions(Object target, Object sender) {

        return actionsmain ;
    }

public void handleAction(Action action, Object sender, Object target) {
if (action == ADDA) {

}
if (action == ADDV{

        }
        else {
          
          
        }
  }

}

Horst

I would do it like this ( tested and worked )


import com.vaadin.event.MouseEvents;
import com.vaadin.event.MouseEvents.ClickEvent;
import com.vaadin.event.MouseEvents.ClickListener;
import com.vaadin.ui.Panel;

public class PanelClick extends Panel implements ClickListener{

	public PanelClick(){
		addListener((ClickListener)this);
	}

	public void click(ClickEvent event) {
		if(MouseEvents.ClickEvent.BUTTON_RIGHT == event.getButton()){
			System.out.println("Right mouse button clicked");
		}
	}
}

Thanks a lot!

And how I get my actionmenu in this contex ??

call getAction into the if statement?

public Action getActions(Object target, Object sender) {

return actionsmain ;
}

Horst