Adding popup menus to custom vision component

I am trying to add a popup menu to a vision component (java bean component) but have not able able to do. My questions are:
(1) is this first possible and if yes how.
(2) if it is not possible, is there a way to program the component so the ignition scripts to add a menu in the designer are automatically added o the component.

Yes. You will have to create a mouse listener that constructs and displays the menu with the correct trigger, and you will have to add an instance of this listener to your component. Typically done in the component’s constructor, from what I’ve seen.

Thank you, it does work.